# NAV & LOGO Airbus Fenix Date Script RPN

## Recommended Posts

Good morning

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 by ptimale

##### Share on other sites

(E:LOCAL·DAY·OF·MONTH,·Number)·2·%·0·==·if{·1·}·els{·2·}·(>L:S_OH_EXT_LT_NAV_LOGO,·Number)

LORBY-SI

##### Share on other sites

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

##### Share on other sites
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 by Lorby_SI

LORBY-SI

##### Share on other sites

Thanks for the explanation

what I don't understand is 2% 0

if today's date is 0 ?

##### Share on other sites

"%" 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 by Lorby_SI

LORBY-SI

##### Share on other sites

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.

## Create an account

Register a new account