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.

MAIN_EXIT_OPEN - Using this and detecting secondary exit

Featured Replies

Hey all,Things are coming along well with my project. I have converted all the code to C++, and got that all working, making it much easier to encapsulate stuff. Soon, I'll see if I can eliminate the need for global variables altogether by creating class wrappers for gauges.Anyway, I have a question. I noticed that the gauge token, MAIN_EXIT_OPEN, transitions to true when the user opens the main exit, but then it transitions back to false once the exit is open. Have you guys noticed this as well, or is it my imagination?While I can easily solve the problem this creates, what I'd like to do is detect exit 2 openning/closing. However, it appears there is no corresponding token. I suspect all this is because the exits work like the engines in that you first have to select the engine, then do something to it.Still, I cannot locate the correct token(s) after reviewing the fs9gauge.h several times.Anyone know how to do this?PatrickFYI: I want you guys to know that if you are not yet using VS 2005, you are missing a treat. I highly recommend it.

There is no token for exit 2, but you can use the detour via the XML access functions aicraft_varget(get_aircraft_var_enum doesn't work, use XML_TOKENS instead) or execute_calculator_code.

  • Moderator

I would also point out that there is some inconsistency between the index 'systems' used by the SDK...The "token's" index begins at zero, but the key_event index begins at one... execute_calculator_code("(A:Exit:0, bool)",&exit1,NULL,NULL);execute_calculator_code("(A:Exit:1, bool)",&exit2,NULL,NULL);execute_calculator_code("(A:Exit:2, bool)",&exit3,NULL,NULL);execute_calculator_code("(A:Exit:3, bool)",&exit4,NULL,NULL);The key_events (both C and XML) would use Select 1 for Exit:0, Select 2 for Exit:1, etc. *:-*

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Wow... did you hear that sound?That was the sound of both of your responses going right over my head! Hahahaha :-zhelpJust when I thought I had this stuff down to a science. :-lolPatrick

OK step by step.There are some tokens available in XML that aren't in the GAUGE_TOKEN list.Therefore you can't use them as a SOURCE_VAR in any MAKE_... macro, but you can use MODULE_VAR_NONE instead and introduce a matching callback function, where you call one of the both mentioned methods to get the tokens from the XML engine instead. E.g. a MAKE_ICON like this:FLOAT64 FSAPI exit2_cb(PELEMENT_ICON pelement){ FLOAT64 exit2 = 0; execute_calculator_code("(A:Exit:1, bool)",&exit2,NULL,NULL); return exit2;}MAKE_ICON( exit_2_icon, ..., ..., ..., ..., ..., ..., ..., MODULE_VAR_NONE, exit_2_cb, ..., ..., ..., ...)More clear?

Yes, I understand now. Now I understand why you added all the XML vars to the gauge.h too. :-beerchugNever noticed those functions before, so I'll have a look at them as well.Thanks for the help guys.Patrick

Ok, I tried this code, setting it to the main exit so that I could easily test it, and no joy.ICON_UPDATE_CALLBACK baggageDoor_cb;MAKE_ICON( baggageDoor_icon, BMP_ANNUNCIATOR_BAGGAGEDOOR_OFF, NULL, annunciator_fail, IMAGE_USE_TRANSPARENCY | IMAGE_USE_ERASE, 0, X_C7, Y_BTM, MODULE_VAR_NONE, baggageDoor_cb, ICON_SWITCH_TYPE_SET_CUR_ICON, 2, 0, 0)FLOAT64 FSAPI baggageDoor_cb(PELEMENT_ICON pelement_icon){ FLOAT64 isBaggageDoorOpen; execute_calculator_code("(A:Exit:0, bool)", &isBaggageDoorOpen, NULL, NULL); return isBaggageDoorOpen;}By the way, any idea what the other two parameters are for?Patrick

Sorry wrong XML-Syntax. Try execute_calculator_code("(A:EXIT OPEN:0,bool)", &isBaggageDoorOpen, NULL, NULL);The other parameters are for the cases where integer or string results are returned.

Thanks Arne, works perfectly. It's been so long since I've looked at XML tokens I didn't notice either.Patrick

  • Moderator

>Thanks Arne, works perfectly. It's been so long since I've>looked at XML tokens I didn't notice either.Sorry! I was more concerned with the different indexes used and spaced out on the precise XML variable name... :-spacecraft

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Bill,No worries, if I wasn't such a noob, I'd have caught it.Patrick

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.