• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

MSFS20 Reverse Polish Notation

Lagaffe

Resource contributor
Messages
986
Country
france
Hi,

Trying to add new functions on my addons, I read a lot of XML scripts of others developpers to learn others things.
Yesterday, I read this kind of code that an author use often in it scripts :
1 (L:VARIABLE_A) if{ "do something" } els{ "do other" }

I rather expected a code of this type with an explicit test like : == or >
1 (L:VARIABLE_B) == if{ "action to do" } els{ "other action"}
As I did not see the meaning of this code, I have read several time the "bible" without finding any answer.
The only explanation is that we simply test that the variable is well equal to 1, the 1 first on the line is only there to remember this fact

My question: Is it this syntax correct ? Something is missing ? Is it a mistake ?
If not that is the signification of the first code (in bold and blue)
 
Last edited:
Hi, it is correct, it means if the VARIABLE_B exist, I mean, If some other instruction set a value to it, 0, 1, 0.1... what else value.

I'm not an expert, but everything I've learned with RPN is, forget everything else you know about pseudocode xD
 
Last edited:
I don’t think it is a test of the existence of the variable otherwise why do two treatments based on the return value : if{*} else{**}
This lines appear several times in the XML code so I don't think it is an error ... or the author was a bad programmer :rolleyes:
 
I think it does check for any value other than 0, If true than do this, if false (0) then do that.
 
hope that wasn't me ;).
I always use simplest code in XML. use C++ for logic, C++ logic easy accepted with my brain.

back to the issue:
maybe he/she still learning and use the power of "copy-paste", as long as it work as intended, move on. my :twocents:
 
Thanks for your answer. No it is not your code ;)
I think I prefer to use proven and simple code (like my second example) rather than trying this kind of thing ... on which we have several interpretations.

I thought there was a great thing down there, actually I think he just made mistakes and didn’t notice.:confused:
 
@rhumbaflappy is true, means different to 0.

To test your RPN expressions, you can create a very simple testing bench using a Behaviors xml file from any plane. In this example, using the animation open door, if the variable "hola" is different to 0, the animation value is 1, door open.
behaviorsxml.jpg

value0.jpg


value not 0.jpg
 
Muchas gracias por su tiempo dedicado ! (mis abuelos eran de las Baleares :cool:)

Thanks you very much for your complete answer: I will try tomorow. I use very little the interface of the DEV mod, passing more easily by the command line tools
 
that are different between:
XML:
1 (L:VARIABLE_A, enum) if{ "do something" } els{ "do other" }
with this
XML:
(L:VARIABLE_A, enum) if{ "do something" } els{ "do other" }

2nd code are correct
if not bolean, usually use:

XML:
(L:VARIABLE_A, enum) 2 == if{ "do something" } els{ "do other" }

<!-- or -->

(L:VARIABLE_A, enum) 0 &gt; if{ "do something" } els{ "do other" }
 
Yes, Kalong, I agreed perfectly ;)

PS: I program XML since 2006 so I a not that we can call "a beginner in RPN" but I was very surprised by this syntax that I doen't understand ... and I can’t stand not understanding something :cool:
 
Back
Top