September 16, 20232 yr Good morning Google translation NAV & LOGO Airbus a320 Fenix Is it possible to create a script that would do this: If today's date is odd then set the NAV & LOGO switch to 1 If today's date is even then set the NAV & LOGO switch to 2 I know that it's useless, in simulation it's just out of curiosity THANKS Edited September 16, 20232 yr by ptimale
September 17, 20232 yr Commercial Member (E:LOCAL·DAY·OF·MONTH,·Number)·2·%·0·==·if{·1·}·els{·2·}·(>L:S_OH_EXT_LT_NAV_LOGO,·Number) LORBY-SI
September 18, 20232 yr Author Good morning it works very well thank you I was looking in the docs if a function existed, but it was in simvar\environment variables could you explain your script to me? THANKS
September 18, 20232 yr Commercial Member 36 minutes ago, ptimale said: could you explain your script to me? "If the day of the current date modulo 2 equals 0 then set the appropriate Fenix LVar to 1, if not, set it to 2." What is it specifically that you don't understand? Edited September 18, 20232 yr by Lorby_SI LORBY-SI
September 18, 20232 yr Author Thanks for the explanation what I don't understand is 2% 0 if today's date is 0 ?
September 18, 20232 yr Commercial Member Reverse Polish Notation (flightsimulator.com) Modulo - Wikipedia "%" is the modulo operator in flightsim RPN. Any number modulo 2 results in either 1 or 0 (= odd or even), and that is then tested with the == if{ Edited September 18, 20232 yr by Lorby_SI LORBY-SI
September 18, 20232 yr Author In your RPN expression, you divide the local day of the month by 2 (E:LOCAL · DAY · OF · MONTH, · Number 2%). If the result of this division is zero, it means that the day of the month is even, because an even number divided by 2 leaves no remainder. Otherwise, if there is a remainder, the day is odd. So in your expression, if the day of the local month is even, it will return 1 (with "si{ 1 }"), otherwise, it will return 2 (with "els{ 2 }"). This allows you to determine whether the day is even or odd based on the return value of this expression.
Archived
This topic is now archived and is closed to further replies.