MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

05/03/2024 - This forum is read-only

The community support for MobiFlight has moved exclusively over to our Discord server. Register for free and enjoy more interactive functions like image and video upload, voice chat. More than 7,000 registered users around the world make it a great experience!

See you on our MobiFlight Community Discord server.

A HUGE Thank You to everyone who participated in the forum, especially obviously to Pizman and Stephan who did an outstanding job over so many years providing an incredible service to the MobiFlight community.

The forum is still providing a lot of good content, hence we keep this information accessible.

icon
Avatar
coussini
Posts: 2
I'm new here. So hello everybody

I have a question specificaly from Hubhop site and a RPN Code for the Fly By Wire / Light / A32NX_NAV-LIGHT_TOG

The code is :

(L:LIGHTING_NAV_0)
if{
0 0 (>K:2:NAV_LIGHTS_SET)
0 0 (>K:2:LOGO_LIGHTS_SET) }
els{
0 1 (>K:2:NAV_LIGHTS_SET)
0 1 (>K:2:LOGO_LIGHTS_SET) }

Question: Can you explain, how to interpret this. I saw conditions... but I can't understand that. I do not know this programmation code.

Best regards.
2022-10-19 14:34
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi

At first.... Here our User "JaimeLeon" and "Tuomas" on our Discord https://discord.gg/99vHbK7 are very advanced.
They know all this RPN stuff and can help better like me.

You can also google for a lot of guides how to programm in RPN....: those explane the syntax.

About Question.....
I also not fully know this stuff but most is logical.

The upper part is the Read .... (L:LIGHTING_NAV_0) So we read this Variable ....
In the MIddle there are "writes" (>K:2:NAV_LIGHTS_SET) The ">" is the syntax to WRITE something

means basically... We Read a Lvar .... We made a logical If Statement , and finally we execute commands in case of the Condition.

The If itself indicated by the BOOL Status .
Its a little confusing in case we not say something like if $=1 like here in Mobiflight Transform....
The if in RPN without anymore parameter simply means.... If Boolean TRUE, THEN do, ELSE do ( Else means Boolean FALSE)

In that example.... If Lvar " LIGHTING_NAV_0" is TRUE (ON)
THEN :
0 0 (>K:2:NAV_LIGHTS_SET)
0 0 (>K:2:LOGO_LIGHTS_SET)
That means send on Index position 0 ( of this multi index K Event) a value of 0
This code do 2 things in a row... it set the Nav and the logo Lights both to 0

ELSE :
0 1 (>K:2:NAV_LIGHTS_SET)
0 1 (>K:2:LOGO_LIGHTS_SET)
Here it again set the Index 0 part of these KEvents but now with Value 1:

********
In very simple words....
We say Read Lvar (i expect the current state of that Nav Lights)
And we say IF these are currently 1 THEN set Nav and Logolights same time to 0.... ELSE (If var is currently 0) set both to 1.

Summary: The logic is easy.... Just the "Index" is the confusing part here....
Good Luck !
2022-10-20 22:57
Avatar
jaimeleon
Posts: 26
If you want to know more about RPN syntax, please read the guide in the MSFS2020 SDK web site
https://docs.flightsimulator.com/html/Additional_Information/Reverse_Polish_Notation.htm?rhhlterm=rpn%20guide&rhsearch=rpn%20guide
2022-10-21 00:34
icon