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.

Triggering events from select-statements in XML

Featured Replies

Hi,once more, it's me with a neewbe-question. Sorry for that...With all the kind help, programming goes along quite well. Now I found a new problem I cannot solve and find no hints on:I want to trigger an event depending on conditions checked by a select-statement. The idea is to create a virtual "co-pilot" that will do certain things he would do in real life. Like operating the gear, flaps, spoilers, airbrake, thrust-reverses etc. based on simulator-conditions and a preselectedt mode like taxi, takeoff, climb, cruise, descent, approch, land etc...Looks like this:(A:AIRSPEED INDICATED, knots) (L:VCP_FLU1_SPEED, knots) ><-trigger event here->I Also tried:(A:AIRSPEED INDICATED, knots) (L:VCP_CONTROL_SPEED, knots) >(>K:FLAPS_UP)as a basic test. I Know this will fire the trigger over and over again as long as condition is true. But it just did nothing.. What do I have to do to fire a trigger here?

Hi,Try something like:(A:AIRSPEED INDICATED, knots) (L:VCP_FLU1_SPEED, knots) >if{ (A:FLAPS HANDLE INDEX,enum) 0 > if{ (>K:FLAPS_UP) }or something els you want. } els{ here something different. }Jan"Beatus ille qui procul negotiis..."

Jan

 

 

 

"Beatus ille qui procul negotiis..."

What you try to do (triggering events in a Case construction) simply isn't defined in XML.The usage of the Case construction (unlike in "normal" programming languages) is very limited in XML.As far as I know, the Case can only be used for two things:1. Selection of an Image (the construction you mentioned)2. Selection of a value (numerical or string) from a list, based on the value of an enumerated variable.Like in:10 20 30 3 (G:Var1) casethat pushes the value 10 , 20 or 30 onto the stack if (G:Var1) is resp. 2,1, or 0.Or in:'string1' 'string2' 2 (G:Var1) caseBut, as Jan said, what you are trying to accomplish can simply be done with (nested) if-els constructions.Rob Barendregt

Just to add one thing Rob forgot to mention (I learned a lot from him, so I guess this is nothing new to him...)To trigger an event only once use a spcific variable for this, which by default has a zero value. But after the triggering set this variable to something different like this:(L:test,bool) 0 == if{ -trigger event- 1 (>L:test,bool) }So the -trigger event- will only be executed once.Simple, isn't it?Herbert

>Just to add one thing Rob forgot to mention (I learned a lot>from him, so I guess this is nothing new to him...)>>To trigger an event only once use a spcific variable for this,>which by default has a zero value. But after the triggering>set this variable to something different like this:>>(L:test,bool) 0 == if{ -trigger event- 1 (>L:test,bool) }>>So the -trigger event- will only be executed once.>>Simple, isn't it?>>>>Herbert>Hi,The other way could be useful as well: (My Condition to fire the event) (>L:test,bool)......(L:test,bool) if{ -trigger event- 0 (>L:test,bool) }since then one can have control of the moment the event needs to be fired. If the trigger is (L:test,bool) 0 ==, as soon as the gauge initializes the event will be fired automatically, which may not be desirable in many circumstances.Tom

Hi,Question:Something like what I use:(L:vnav switch,enum) 1 == if{ (L:vnav pitch,bool) ! if{ (>K:SYNC_FLIGHT_DIRECTOR_PITCH) 1 (>L:vnav pitch,bool) } } els{ (L:vnav pitch,bool) if{ (>K:SYNC_FLIGHT_DIRECTOR_PITCH) 0 (>L:vnav pitch,bool) } } Afaik there is no A:Var for the K:Event??Jan"Beatus ille qui procul negotiis..."

Jan

 

 

 

"Beatus ille qui procul negotiis..."

  • Author

Thx alot for all the help.My virtual co-pilot works well by now.. just in time to find that others had the same idea and solved that already. Well, at least I learned something.

Create an account or sign in to comment

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.