Jump to content
Sign in to follow this  
Guest grimmy69

switching between two bitmaps in warning panel

Recommended Posts

Guest iholrf

My original suggestion, which Bill expanded upon, was to do the following:1: Create a normal bmp background for your gauge..2: Create the "lit" and "unlit" versions of your warning lights.3: over that you create a "virtual" element that is drawn by the sim. This is the part Bill discribs. This virtual element is adjustible in its level of transparancy and can be toggled with the code Bill provided.4: to ensure the levels of transparency do not effect anything but the lit elements and not the background, you then add a mask. The mask is generally just your background with holes cut out (black areas) for the lit and unlit element to be visible through.These are all "layers" in the gauge.Layer1 - background - texturelayer2 - lit or unlit element - textures - depends on statelayer3 - sim drawn virtual transparency (coded not texture)layer4 - mask - textureDoes this make any sense now? Its a bit tough to conceptualized until you get it right once, then it will all seem so obvious.Good luckCheersShad

Share this post


Link to post
Share on other sites
Guest grimmy69

I really appreciate all the help I have been given here! :)I have things working the way I want them with the warning panel now, but I want to do the same thing to a few more gauges. I tried, but the syntax of these gauges is a bit different and since I lack the knowledge I need to do it properly I would like to ask for some advice on where I can read more about the syntax and variables.Looking at a part of the original code of the gauge above(A:GENERAL ENG1 OIL PRESSURE, PSI) 18 < if{ 1 (>L:OILL, numbers) } els{ 0 (>L:OILL, numbers) } (L:OILL, numbers)The part with "A:GENERAL ENG1 OIL PRESSURE" can be found in the SDK documentation. However "L:OILL, numbers" I can't seem to find anywhere.This makes it more complicated with the "Deice Annunciator lights" and "landing gear transition" gauges I am now trying to modify since they only have the first variable like "A:General eng1 anti ice position,bool" and not the second set of variables. Are the second variables (OILL) custom variables defined elsewhere?Also, what purpose does numbers, and enum serve? I do understand that they handle numerical results, but I would appreciate a better explanation! :)Thanks!Roger

Share this post


Link to post
Share on other sites

Hi,(L:var's) can have any name you like.Example:(L:The name you want to give to this Var,bool) (L:The name you want to give to this Var,bool) ! (>L:The name you want to give to this Var,bool)or(L:The name you want to give to this Var,enum) etc.0 (>L:The name you want to give to this Var,enum)other area1 (>L:The name you want to give to this Var,enum)other area2 (>L:The name you want to give to this Var,enum)other area3 (>L:The name you want to give to this Var,enum)etc.enum or number doesn't differ so muchJan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Roger,>This makes it more complicated with the "Deice Annunciator>lights" and "landing gear transition" gauges I am now trying>to modify since they only have the first variable like>"A:General eng1 anti ice position,bool" and not the second set>of variables. Are the second variables (OILL) custom variables>defined elsewhere?Those gauges you name that have the (A:XX) var seem to be properly coded, that with the (OILL) custom var has a redundancy that isn't needed at all in these kind of cases.This is the idea:Suppose you want an annunciator light to go ON as a result of a warning condition.Then you use a bitmap that will show up to reflect that warning state.You put the bmp inside an and tell FS to make it ONLY when that condition is met. To find when does it happen, you use a related FS variable like (A:GENERAL ENG1 OIL PRESSURE, PSI) that needs to be compared to a limit value, ie "18 <". ALL kind of comparisons between variables in XML return a "bool" number; 1 if the condition is met and 0 if it is not.Following your example, you want your bmp to be visible only when (A:GENERAL ENG1 OIL PRESSURE, PSI) is lower than 18.So, the SIMPLEST code to obtain this is:(A:GENERAL ENG1 OIL PRESSURE, PSI) 18 <Of course the approach is different when you need to use a set of two or more bitmaps to reflect a situation, but that's another story :-) >>Also, what purpose does numbers, and enum serve? I do>understand that they handle numerical results, but I would>appreciate a better explanation! :)>>Thanks!>Roger>Those are the "units" in which the variables have to be expressed.There are quite a lot of different ones, most of them having direct equivalency. You might want to read this thread:http://forums.avsim.net/dcboard.php?az=sho...ing_type=searchto get a proper idea.Tom

Share this post


Link to post
Share on other sites
Guest grimmy69

I think I was a bit unclear about what I was having problems with... My fault, but your answers are very interesting to read anyways and is a great help in understanding how it all connects!I already have two working gauges with the following code:(A:General eng1 anti ice position,bool)(L:Test_W, bool) 1 ==AND(L:OILL, numbers) (L:OILR, numbers) + (L:GENL, numbers) + (L:GENR, numbers) + (L:HYDL, numbers) + (L:HYDR, numbers) + (L:UMFX, numbers) + (L:UMFY, numbers) + (L:DACH, numbers) + (L:LOFUL, numbers) + (L:LOFUR, numbers) + (L:Test_W, bool) + (A:ENG1 ON FIRE, bool) + (A:ENG2 ON FIRE, bool) + (>L:Current warnings, numbers) (L:Current warnings, numbers) (L:Check, numbers) < if{ (L:Current warnings, numbers) (>L:Check, numbers)(P:Absolute time, seconds) 1 % 0.5 > (A:Circuit general panel on, bool) &&(L:Current warnings, numbers) (L:Check, numbers) >(L:Current warnings, numbers) (>L:Check, numbers)What I want to do is to modify and convert them to rely on the same "nightlight" variable just as the warning panel does: (A:GENERAL ENG1 OIL PRESSURE, PSI) 18 < if{ (L:Nightlight,enum) 1 == if{ 1 (>L:OILL, numbers) } els{ 2 (>L:OILL, numbers) } } els{ 0 (>L:OILL, numbers) }(L:OILL, numbers) The problem is that there is no equivalent to the "OILL" variable in the warning panel. So I assume that the OILL variable is not a "default" variable but a custom variable defined in another gauge.I really wish someone would write a "xml-gauge programming for dummys" book, but I guess the market is a bit too small... ;)Thanks!Roger

Share this post


Link to post
Share on other sites

Ok.If you only need to have them work using (L:Nightlight,enum), then replace those gauge's code with this one:(A:General eng1 anti iceposition,bool) (L:Nightlight,enum) 1 != 1 + * (* YOU NEED TO PROVIDE THIS BMP *) (L:Test_W, bool) 1 == (L:Nightlight,enum) 1 != 1 + *And (L:OILL, numbers) (L:OILR, numbers) + (L:GENL, numbers) + (L:GENR, numbers) + (L:HYDL, numbers) + (L:HYDR, numbers) + (L:UMFX, numbers) + (L:UMFY, numbers) + (L:DACH, numbers) + (L:LOFUL, numbers) + (L:LOFUR, numbers) + (L:Test_W, bool) + (A:ENG1 ON FIRE, bool) + (A:ENG2 ON FIRE,bool) + (>L:Current warnings, numbers) (L:Current warnings, numbers) (L:Check,numbers) < if{ (L:Current warnings, numbers)(>L:Check, numbers) } (P:Absolute time, seconds) 1 % 0.5 > (A:Circuit general panel on, bool) and (L:Current warnings, numbers) (L:Check,numbers) > (L:Nightlight,enum) 1 != 1 + *(* YOU NEED TO PROVIDE THIS BMP *) (L:Current warnings, numbers)(>L:Check, numbers)NOTE: please replace the ">" and "<" comparators with "&amp"gt; and "&amp"lt; >I really wish someone would write a "xml-gauge>programming for dummys" book, but I guess the market is>a bit too small... ;)Nick Pike has written a great set of XML tutorials for beginers.You can find it here:http://www.fs2x.comTom

Share this post


Link to post
Share on other sites
Guest grimmy69

Brilliant! Thank you so much both for the perfectly working code and the link. I'll make sure to read all the tutorials available there!Just a short note to anyone reading the code above... Should be:The "" end tag was missing. :)Cheers!Roger

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...