September 11, 200520 yr 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;
September 11, 200520 yr 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
September 12, 200520 yr 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