ark1320 Posted April 23, 2023 Report Posted April 23, 2023 Hi John, It seems the ipc.execCalcCode function does not recognize the use of > for the greater than symbol > in XML code. For example, if I execute the little test code below as shown it works in that the displayed value for Test Var1 is correct, a 3. But, if I then go back and change the 3 to a 4 and change the > symbol to > in the first line so it becomes ipc.execCalcCode(" 4 (>L:TestVar1) "), a 3 is still displayed when the code runs. Unfortunately, for some reason the > syntax (which I don't like) is frequently used for the > symbol in XML coding. I copied some code to use in a Lua script that used the ipc.execCalcCode() function in a number of lines, and it took me a loooong time to figure out it wasn't working because the code I copied used the > syntax. If getting the > syntax to work with the ipc.execCalcCode function is not a viable option, then I think a warning note of some kind in the Lua Library and Advanced Users guide would be a good idea. I looked but did not find anything on this. Thanks, Al ipc.execCalcCode("3 (>L:TestVar1) ") ipc.sleep(500) Test_Var1 = ipc.readLvar("L:TestVar1") wnd.clear(w) wnd.text(w, " Test Var1 = "..Test_Var1) ipc.sleep(5000)
John Dowson Posted April 23, 2023 Report Posted April 23, 2023 I don't understand why you would expect calculator code to except what is used in xml markup... 10 hours ago, ark1320 said: If getting the > syntax to work with the ipc.execCalcCode function is not a viable option, then I think a warning note of some kind in the Lua Library and Advanced Users guide would be a good idea. I looked but did not find anything on this. Its certainly not a viable option, and I am not going to add a warning as I think that would be confusing. It accepts a calculator code string, and if you don't know what a calculator code string is, then you should check the MSFS/Asobo documentation to see what is allowed. I only document the additions to that MSFS allows, which is currently the use of $Param which when used will be substituted with the relevant parameter value, and the next release will also allow the @ character for the same purpose, as this is what the MF presets (for potentiometer input) use. Similarly, it is not up to me to document or explain RPN notation. John
ark1320 Posted April 23, 2023 Author Report Posted April 23, 2023 4 hours ago, John Dowson said: and if you don't know what a calculator code string is, then you should check the MSFS/Asobo documentation to see what is allowed. You are right, I had NO idea the term "calculator code" referred to an actual MS/Asobo defined construct. Though it was just a FSUIPC name for a new capability. A search of the MSFS SDK turned up this relevant warning: Always good to lean something new! Thanks, Al
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now