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.

lookup_var() ->value is always zero

Featured Replies

Hi!I've the following problem: When I read a token variable via lookup_var, the returned value is always 0 in this case! It worked with other tokens, but the token GENERAL_PANEL_CIRCUIT_ON always returns 0 even if it is 1.When I read the token via a macro, I get the correct state.(of course , I could take the value from there, but why should I if it would be much better via lookup_var...?!)Also a simple XML gauge returns the correct value.In the Gauge Creation Tut. it says that you should read the token and save it into a local variable to get around the zero-value problem.But it doesnt work.Here the not working code:case PANEL_SERVICE_PRE_UPDATE: lookup_var(&general_panel);//defined as: MODULE_VAR general_panel={GENERAL_PANEL_CIRCUIT_ON };general_a=general_panel.var_value.b;//general_a of type BOOLif(general_a){ SHOW_LISTELEMENT(pgauge->elements_list[0],1); ...}else{ HIDE_LISTELEMENT(pgauge->elements_list[0],1); ...}break;Regards,HarryEDIT: It's now working!!!I don't take the value from the member b, which should hold bool values, I now take the value as FLOAT64 and cast it to BOOL.Very senseless of Microsoft to introduce a bool member which doesn't hold any value...or is there any?general_a=(BOOL)general_panel.var_value.n;

  • Moderator

MODULE_VAR GENERAL_PANEL_CIRCUIT_ONvar = {GENERAL_PANEL_CIRCUIT_ON};int general_panel = GENERAL_PANEL_CIRCUIT_ONvar.var_value.n ;case PANEL_SERVICE_PRE_UPDATE:lookup_var(&GENERAL_PANEL_CIRCUIT_ONvar);break;if (general_panel == 1) {.... ;}As far as I am aware, there are only two types available, .n and .d... ;)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Hi Bill!In the SDK you can find all the types of UNIVERSAL_VAR:typedef union UNIVERSAL_VAR {FLOAT64 n;'You can use any number.BOOL b;// any booleanENUM e;// any enumerated valueFLAGS f;// any flags fieldPVOID p;// any pointerVAR32 d;// any binary coded decimalVAR32 o;// any binary coded octal} UNIVERSAL_VAR, *PUNIVERSAL_VAR, **PPUNIVERSAL_VAR;But maybe only the n and d are really working!? Didn't try around any more after the gauge finally worked;-)Regards,Harry

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.