Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

casse tete script toggle

Featured Replies

Good morning

translated by Google

a little headache for me

Fenix a320

I have a local variable: (L:S_OH_ELEC_EXT_PWR, number)

to activate in the sim it is 1 On 1 OFF

How can we do so that:

0 = OFF
1 = ON

in the Behavior\LocalVariables console I pass the variable to 1 power ON in the sim, then 0 & 1 the variable is OFF in the sim

I hope you will understand me

this script must also do an if = 0 els 0 if = 1 els = 1

thank you in advance, I've been racking my brains for several days on this problem, all I've managed to do is toggle.

  • Commercial Member

As far as I know, the "button" LVar and the "state" LVar are not the same in the Fenix

(L:S_OH_ELEC_EXT_PWR, Number) is only for operating the button. I think that it does NOT tell you the state of the button or the aircraft system. There are bound to be other LVars in play that provide the state information.

Looking at the behavior code in the Fenix' files, the state variables are probably
(L:I_OH_ELEC_EXT_PWR_L, Number)
(L:I_OH_ELEC_EXT_PWR_U, Number)

Edited by Lorby_SI

LORBY-SI

  • Author

Good morning

translated by Google

here is what i managed to do

For ON =

(L:S_OH_ELEC_EXT_PWR, number) s0
(L:S_OH_ELEC_EXT_PWR, number) s1 ++ ++
(L:I_OH_ELEC_EXT_PWR_U, number) 1 != if{s1 (>L:S_OH_ELEC_EXT_PWR, number)} els{s0 (>L:S_OH_ELEC_EXT_PWR, number)}

For OFF =

(L:S_OH_ELEC_EXT_PWR, number) s0
(L:S_OH_ELEC_EXT_PWR, number) s1 ++ ++
(L:I_OH_ELEC_EXT_PWR_L, number) 1 != if{s1 (>L:S_OH_ELEC_EXT_PWR, number)} els{s0 (>L:S_OH_ELEC_EXT_PWR, number)}


but the "if els" don't work

  • Commercial Member
31 minutes ago, ptimale said:

but the "if els" don't work

Of course it does!

But your script is syntactically incorrect, and I'm honestly not sure what you are trying to do with it.

1. You MUST make sure that there is the correct amount of space characters in the script. Those are the most important part.
2. (L:S_OH_ELEC_EXT_PWR, number) s1 ++ ++ does nothing. You store the value, then you increment it twice on the stack. I think that this should be the other way around (so you store the incremented value)
3. "s" writes to register and "l" (that is a lower case ell) reads from it. s1 (>L:S_OH_ELEC_EXT_PWR, number) does exactly nothing

Quote

(L:S_OH_ELEC_EXT_PWR,·Number)·s0·l0·2·+·s1·(L:I_OH_ELEC_EXT_PWR_L,·Number)·1·!=·if{·l1·(>L:S_OH_ELEC_EXT_PWR,·Number)·}·els{·l0·(>L:S_OH_ELEC_EXT_PWR,·Number)·}
 

This would be syntactically correct. But to completely honest - I have no idea what this script is supposed to achieve.

 

Edited by Lorby_SI

LORBY-SI

  • Author

Good morning

translated by Google

I will try to follow your comments tomorrow

but your script works almost 100%

I'm still working on the syntax

I will study your script

THANKS

I wish you a good evening or day I do not know
not what time it is where you are

Olivier

  • Commercial Member

OK, I give up. FENIX A320 version v1.0.6.146

This script toggles the Ext Power button:
1·(>L:S_OH_ELEC_EXT_PWR,·Number)·(SPLIT:100)·0·(>L:S_OH_ELEC_EXT_PWR,·Number)

Ideally you would create all three scripts and have them call each other.

Let us call the group "FNX_A320"
Script 1 Name: Ext_Pwr_Toggle
Script 1 Code: 1·(>L:S_OH_ELEC_EXT_PWR,·Number)·(SPLIT:100)·0·(>L:S_OH_ELEC_EXT_PWR,·Number)

Script 2 Name: Ext_Pwr_On
Script 2 Code: (L:I_OH_ELEC_EXT_PWR_L,·Number)·0·==·if{·1·(>K:FNX_A320-Ext_Pwr_Toggle)·}

Script 3 Name: Ext_Pwr_Off
Script 3 Code: (L:I_OH_ELEC_EXT_PWR_L,·Number)·1·==·if{·1·(>K:FNX_A320-Ext_Pwr_Toggle)·}

 

If the first script doesn't work because your computer is too slow, increase the value in the (SPLIT: 
Try 150 or even 200

Edited by Lorby_SI

LORBY-SI

  • Author

Good morning

translated by Google

thank you for your help this script works well
I have the syncronization of the physical buttons and in the simulator

I almost understood the script:

when we call Ext_Pwr_On it verifies that I_OH_ELEC_EXT_PWR_L is exactly and equal to 0 then it sends 1 to FNX_A320-Ext_Pwr_Toggle

why should we send 1?

why not written like this?

(L:I_OH_ELEC_EXT_PWR_L, Number) 0 == if{(>K:FNX_A320-Ext_Pwr_Toggle) }

(L:I_OH_ELEC_EXT_PWR_L, Number) 0 == if{ 1 (>K:FNX_A320-Ext_Pwr_Toggle) }

Thank you again for your help

  • Author

Good morning
translated by Google
I was inspired by the same method for FBW A320 if it can help:

Let us call the group "FBWA32NX"

Script 1 Name: OVHD_ELEC EXT PWR TOGGLE
Script 1 Code: 1·(>K:TOGGLE_EXTERNAL_POWER)

Script 2 Name: OVHD_ELEC EXT PWR ON
Script 2 Code: (A:EXTERNAL·POWER·ON,·Bool)·0·==·if{·1·(>K:FBWA32NX_PERSO-OVHD_ELEC·EXT·PWR·TOGGLE)·}

Script 3 Name: OVHD_ELEC EXT PWR OFF
Script 3 Code: (A:EXTERNAL·POWER·ON,·Bool)·1·==·if{·1·(>K:FBWA32NX_PERSO-OVHD_ELEC·EXT·PWR·TOGGLE)·}

Olivier

  • Commercial Member
57 minutes ago, ptimale said:

why should we send 1? why not written like this?

Because that is the syntax that AAO will process. When the K: doesn't actually use that parameter, it doesn't matter if you provide 0, 1 or anything else. AAO just wants to see something there.

Edited by Lorby_SI

LORBY-SI

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.