October 29, 200817 yr Moderator This is bizzare. This works (backwards of course): (A:AUTOPILOT MASTER,bool) 0 ==A/P But this will NOT work! (A:AUTOPILOT MASTER,bool) 1 ==A/P Neither does this! (A:AUTOPILOT MASTER,bool) 0 !=A/P Does anyone have any idea why??? Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
October 29, 200817 yr Commercial Member The SDK states:"The only reliable numeric equivalent is that 0 is returned for False. Non-zero values, especially both 1 and -1, are used to indicate True. "I'd believe the very first sentence religously.You might try looking at it as a number value instead of a bool value... oh, and according to the SDK, it's Bool.. not bool. Ed Wilson Mindstar AviationMy Playland - I69
October 29, 200817 yr Hi,May be it doesn't work in formattedtext, try normal textOtherwise something like:Color="%('color1' 'color1' (A:AUTOPILOT MASTER,bool) ?)" etc.%((A:AUTOPILOT MASTER,bool))%{if}A/P%{else}A/PBtw. i use (A:AUTOPILOT MASTER,bool)or(A:AUTOPILOT MASTER,bool) !Jan"Beatus ille qui procul negotiis..." Jan "Beatus ille qui procul negotiis..."
October 29, 200817 yr Author Moderator Thanks, Jan.This works a treat:%((A:AUTOPILOT MASTER,bool))%{if}A/P%{else} However I could have sworn I'd already tried that variation at least once! Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
October 29, 200817 yr Bill, the behavior you describe is really weird.(A:Autopilot Master,bool) MUST return 0 or 1 - no other option possible. Maybe the problem was elsewhere? The only Avar with bool unit that returns -1 is (A:HSI CDI NEEDLE VALID,bool) so far I've tested, which I assume as a code bug.Anyway, the very advantage of using bool unit is precisely that you don't need to make any comparison at all, just the Avar itself will put a 0 or 1 in the stack, as you've already noticed :-)And regarding Ed's comment on unit spelling, remember that variables, units and events are NOT case sensitive; they are translated to uppercase by the parser (then BOOL, Bool and bool are all ok)Tom
October 29, 200817 yr Author Moderator >Bill, the behavior you describe is really weird.>(A:Autopilot Master,bool) MUST return 0 or 1 - no other option>possible. Maybe the problem was elsewhere? >The only Avar with bool unit that returns -1 is (A:HSI CDI>NEEDLE VALID,bool) so far I've tested, which I assume as a>code bug.Tom, I monitored the A:vars in question and they indeed did report correct values......so, obviously the problem must be that (A:var,unit) simply won't work with formatted text...I've used Jan's suggestion and simply put the conditions in the script and it seems to be working fine now... :-beerchug I truly hate having to do it this way since it's a major PITA, but that's they way the cookie crumbles... :( Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
Create an account or sign in to comment