Sign in to follow this  
phjvh

XML macro for bright/luminous flags?

Recommended Posts

Never managed to control the Bright/Luminous flags successfully using macros in XML. I know this is an old issue but I could not find any post related to it. So here goes:A plain 1 or 0 works, like this:1but not this:%('1' '0' 2 (L:SWITCH,enum) case)Why? /Tom

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

>Never managed to control the Bright/Luminous flags>successfully using macros in XML. I know this is an old issue>but I could not find any post related to it. So here goes:>>>>A plain 1 or 0 works, like this:>1>>but not this:>%('1' '0' 2 (L:SWITCH,enum) case)Remove the single quote marks... :)(Macro Name="Lit">1 0 2 (L:SWITCH,enum) case)

Share this post


Link to post
Share on other sites

Bill: Sorry, that won't fly. :( First thing I tried. I believe the value must be a boolean, and any sort of operation in the macro makes it a float? Would be easier in C I think. The reason I tried with a string macro btw was that it works with Color/FillColor attribs. Jan: That method is what I have been using for years now, it works fine but is cumbersome for large gauges with dozens of bitmaps. I need to toggle the bright flag when I change bitmaps, so a macro just for bitmap names is not enough. Thanks a bunch anyway!/Tom

Share this post


Link to post
Share on other sites

>Bill: Sorry, that won't fly. :( First thing I tried. I>believe the value must be a boolean, and any sort of operation>in the macro makes it a float? Would be easier in C I think. >The reason I tried with a string macro btw was that it works>with Color/FillColor attribs.That is a bit odd, isn't it? Have you tried using "bool" as the type rather than "enum"? How about actual strings? I'm just batting some suggestions here. I'm in the middle of working on an FSX XML gauge, and the syntax is completely different, so I can't really test these myself at the moment... ;)(Macro Name="Lit">'True' 'False' 2 (L:SWITCH,string) case) If you think this is challenging, wait 'till you get to FSX XML gauges with alternate _night bitmaps (which fortunately, work automatically!) which present some rather "interesting challenges" with regards to getting the 2d and VC panel lighting balanced!

Share this post


Link to post
Share on other sites

Thanks Bill, I will follow your suggestions and experiment.The FSX SDK actually scared the living daylights out of me. I have to reconsider if I really have time for all this... Maybe it's time to hand this bloody aircraft (Saab 35) over to people with more brain cells left. ;) Cheers /Tom

Share this post


Link to post
Share on other sites

Tom,"Bright" property doesn't accept stack evaluation or coditionals.as it happens with almost all of the structures' properties (there are a bunch of exceptions)So, for example, Bright="@Lit" will work using only these kind of macros:1YesHope this helps.Tom

Share this post


Link to post
Share on other sites

>So, for example, Bright="@Lit" will work using only these kind>of macros:>>1>Yes...which is - of course - completely useless... ;)What I've had to do is essentially clone all of the completed "lighted" and change their Bright flags to zero, then encapsulate both non-lighted and lighted as children of their controlling "Parents..." ;)

Share this post


Link to post
Share on other sites

>...which is - of course - completely useless... ;)>You bet...:-hmmm >What I've had to do is essentially clone all of the completed>"lighted" and change their Bright flags to zero,>then encapsulate both non-lighted and lighted as children of>their controlling "Parents..." ;)...using in a single element, that's the way to switch between lighted-non lighted bitmaps IMHO. :-)Tom

Share this post


Link to post
Share on other sites

Hi,Like:(L:capt instr bus AC volts,number) 100 > (L:panellights,bool) 2 * +@poweretc.Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

..or better :-)(L:capt instr bus AC volts,number) 100 > (L:panellights,bool) 2 * +@powerPity this wouldn't work in FSX as is...(I think)Tom

Share this post


Link to post
Share on other sites

Hi,That is a good one, but doesn't work when eg.:@power@current if{ (A:Indicated Altitude,feet) s3 100000 + 100000 % 10000 / flr s0 l3 100000 + 10000 % s1 9980 >= if{ l1 100 % 80 - 20 / } els{ 0 } l0 + } els{ 0 } Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Try putting the nonlinearity table inside the SHIFT statement instead. Works for me./Tom

Share this post


Link to post
Share on other sites

Hi Jan, why is that? it should work with:@power@current if{ (A:Indicated Altitude,feet) s3 100000 + 100000 % 10000 / flr s0 l3 100000 + 10000 % s1 9980 >= if{ l1 100 % 80 - 20 / } els{ 0 } l0 + } els{ 0 } Tom

Share this post


Link to post
Share on other sites

Tom,That is new for me and certainly worth a try.Much more efficient and may be fps...?Thanks!Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

>Tom,>>That is new for me and certainly worth a try.>Much more efficient and may be fps...?>Thanks!>>Jan>>"Beatus ille qui procul negotiis..."Jan, I don't know about fps saving, but for sure implies less code. It has to do with the order of execution inside an structure.First, any of the element.Then, any Then and last, with all its carry: ,, etcThen the rotating/shifting elements.This is for FS9, I'm not sure it is interpreted the same way in FSX.Tom

Share this post


Link to post
Share on other sites

Hi,I tried this one, but no succes (backlighting)@power(L:Autobrake,number) s0Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Jan, It seems that you have a rotary switch for autobrakes.Ok, then supposing the switch indicator points to north (0) position, you could try this: goes ie from 0 (OFF) to 4 (RTO); each position rotates 30 degrees, north (0) is position 2Then,..etcThat's it. In case it doesn't work with our example, you can try placing one section into each ... section.Tom

Share this post


Link to post
Share on other sites

Tom,I use this one without any problem, only some more code:(L:Autobrake,number) s0(L:capt instr bus AC volts,number) 100 > (L:panellights, bool) andl0Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this