Archived

This topic is now archived and is closed to further replies.

kanogek

All Lights Illuminated

Recommended Posts

Hi,I want to make a gauge that toggles every switch light on the panel and overhead, how can I do this? I am having problems with things like (L:...) and can someone tell me what '& amp' means?I have so far made the switch move up and down, made the click areas and things like that, it's just the electrical things that I'm having problems with.What would go between and to turn all of the switch lights on?(I'm not talking about the panel lights but the lights that appear on the actual switches themselves)Please somebody help me!ThanksKind RegardsJonathan

Share this post


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

Hi,assuming this is for FS9.did you have a look at for instance the beach baron gauge cab?In there you will find the nav lights gauge, it shows you how to toggle a light. Work from there."&" means and. Actually you need to use it twice.(L:...) can be any variable that you define for yourself.Example:(A:SIM ON GROUND, bool) (A:Exit open:1, percent) 5 < && if{ 10 (>L:Myvar, number) } els{ 5 (>L:Myvar, number) }If the sim is on ground AND exit 1 is less than 5 percent open it will execute the code after if{ ...}. In this case it will give L:Myvar, number a value of 10.If either one of the conditions is not met, so the exit is further open than 5 percent for instance, 5 will be the value of L:Myvar, number.You can use this as a control function for an animation or maybe a lights toggle, etc.L:Myvar, number can have any name you like. Hope this helps!grtWillemps why does this messageboard system screw up my code? It replaces some code with <, >, & etc. is there a way of preventing this? The

Share this post


Link to post
Share on other sites

Hi,Thanks, that helped a lot. I don't understand the use of 'L:...'. Does fs9 only read the 'L' and the unit?If '{ 10 (>L:Myvar, number)' is given a value of 10, what will it do? What would happen differently if you gave it a value of 20?Can you explain to me what 'enum' means? Would I only use L:... in my gauge for turning the switch bitmap up and down? What would I need to put in to turn every switch light on?Sorry, it's a lot of questions LOL but if you could answer all you can that'd help.ThanksKind RegardsJonathan

Share this post


Link to post
Share on other sites

(Read my previous reply)Would I have to use an internal variable ( output ) to switch every light on? If so, the problem is there isn't a command in the SDK to do such a thing. Would I need to do it with L:...? How can I do it with L:... if I can name it to whatever I want, it obviously wouldn't communicate with fs9? Also, I put this line in, what exactly does it mean?(L:LTest,bool) ! (L:Lsw_off,enum)Pleas help LOL!Kind RegardsJonathan

Share this post


Link to post
Share on other sites

Hi,>If '{ 10 (>L:Myvar, number)' is given a value of 10, what will>it do? What would happen differently if you gave it a value of>20?The sim does not do anything with that as such. But YOU can use it to control functions (eventid's) of the sim depending on a certain value of the L:Var.You could have the nav lights toggle when L:Myvar, number is 10 and the taxi light toggle when L:Myvar, number is 20.Just as an example.An L:Var is used panel wide, so it can be used in multiple gauges.>Can you explain to me what 'enum' means? Would I only use>L:... in my gauge for turning the switch bitmap up and down?>What would I need to put in to turn every switch light on?I think that enum basically means the same as number. Not sure though. I mostly use number.Have a look in the SDK, the Eventids document has all the controllable thingys that you can use in it.Maybe for you ALL_LIGHTS_TOGGLE would be appropriate?(>K:ALL_LIGHTS_TOGGLE)is the xml that would be usable.hope this helps.grtWillempshave you checked out the tutorials over at FS2x.com?They really helped me a lot, a real need to read that is.

Share this post


Link to post
Share on other sites

Hi,Thanks for your help so far buddy! ALL_LIGHTS_TOGGLE would also toggle the outside lights and the lights that light up the panel, I need a command that turns on all of the switch lights.This is a gauge that does what I want it to do but it is for a different aircraft:(Ignore the 'emerLT' bits, they control the emergency lighting.) (L:LTest,bool)(L:EmerLT,bool)(L:DC_ESS_Bus,bool) (L:LTest,bool) &(L:EmerLT,bool) 0 == ! (L:LTest,bool) || (L:DC_ESS_Bus,bool) &(L:LTest,bool) ! (>L:LTest,bool) 1 (>L:snd_sw_large,enum)(L:EmerLT,bool) ++ d 2 > if{ 0 } (>L:EmerLT,bool) 1 (>L:snd_sw_large,enum) What do the exclamation marks mean? Why is there a 1 after '(>L:LTest,bool)'? I'm thinking that this part determines what happens: (L:LTest,bool) ! (>L:LTest,bool) 1 (>L:snd_sw_large,enum)Can you explain this to me? If they are all (L:... that means it won't communicate with fs9? Since they are no event ids, where does fs9 go to find the information on what to do when it is clicked?Also,I tried making a simple gauge for practice but now the switch is just staying on the same bitmap when I click it even though I've got the right bitmaps. Here is is(A:Landing Lights,bool)Do you know why?You've been very helpful so far, thank you very much.Kind RegardsJonathan

Share this post


Link to post
Share on other sites

Hi,you need to take baby steps here.Start out simple and continue onwards from there.So begin by being able to control all lights from one switch and understanding the why's and how's.As for your example gauge:Well it seems that this is an example of L:vars being used panel-wide.I suppose the real controlling of the lights gets done in another (part of this) gauge.L:Vars do not have any direct effect on FS.(A:Landing Lights,bool)There seems to be something wrong here. Check out the SDK parameters doc for the available parameters and stick to those.(L:LTest,bool) ! (>L:LTest,bool) 1(>L:snd_sw_large,enum)Ah yes that is RPN for you... You have to read it in a different manner.(L:LTest,bool) ! (>L:LTest,bool) toggles the value of L:LTest, bool.1 (>L:snd_sw_large,enum) sets L:snd_sw_large, enum to the value of 1.So in effect when clicked, L:LTest, bool toggles its value and L:snd_sw_large, enum gets a value of 1.Might i suggest using the excellent black box debugging gauge if you don't already do so? With this tool you can read the values of variables in a gauge from within FS. It is a very useful tool!!!grtWillem

Share this post


Link to post
Share on other sites

By no means this is the most elegant solution and still needs some expansion but here's a starting point (it seems that the ALL_LIGHTS_TOGGLE only switches on the lights instead of toggling, well on my system anyway):(L:Lights, bool)Lights System: %((A:LIGHT BEACON, bool))%{if}On%{else}Off%{end}(>K:STROBES_TOGGLE) (>K:TOGGLE_BEACON_LIGHTS) (L:Lights, bool) ! (>L:Lights, bool) grtWillem

Share this post


Link to post
Share on other sites

hi,why are there 2 brackets in some places? Also, what does the % sign mean? (>K:STROBES_TOGGLE)(>K:TOGGLE_BEACON_LIGHTS) (L:Lights, bool) !(>L:Lights, bool) I don't understand the above, could you give an explanation?ThanksKind RegardsJonathan

Share this post


Link to post
Share on other sites

Jonathan. For a description of the xml gauge syntax do a search and download xmlgau01.zip from the file library here.Also check out the tutorials in section 1 at fs2x.com.Hope this helps Ted.

Share this post


Link to post
Share on other sites

Jonathan,i partly misunderstood your question i'm afraid, sorry for that...I thought you needed to toggle all lights except the panel lights, but did you mean to have a test switch that lights up the integral switch lights (pushbutton lights)? If so, then what you need is to control the visibility of the lit-up bitmaps of those pushbuttons. This is a typical example of L:Vars, because it does not do anything in the sim as such. It will only be eye-candy so to speak.Basically it is the same sort of code i posted earlier, except you don't need to have the XXX_TOGGLE_XXX there.You can use L:Lights, bool to control the visibility of the bitmaps pretty much in the same manner as the Switch_Lights_Nav_Off. bmp and Switch_Lights_Nav_On. bmp... That should get you going.Keep the grey matter pumping man!!And as Ted and i already said, check out the tutes at FS2X.com. They are really well written, and also apply to FS specifically.grtWillem

Share this post


Link to post
Share on other sites

Hi,OK, so I could for example put (L:Sw_Lights, bool) instead of (L:Lights, bool)?So, what would I put in between and also ?ThanksKind RegardsJonathan

Share this post


Link to post
Share on other sites

Hi,yes you could put (L:SW_Lights, bool) instead of (L:Lights, bool), it is an L:Var so you can name it what you like. As long as the rest of the gauge refers to that same name where needed of course. (L:Lights, bool)This is a way to check the value of L:Var (L:Lights, bool). So if that value is 0, the rest of the code will be executed which in this case is to show the bitmap with the name "Switch_Lights_Nav_off.bmp".If it is of value 1, well than the code linked to will be executed.(>K:STROBES_TOGGLE)(>K:TOGGLE_BEACON_LIGHTS) (L:Lights, bool) !(>L:Lights, bool) This is code that will be executed upon a mouse click on the (specified area of the) gauge. Given the fact that you want to toggle the value of (L:Lights, bool) well that is what should be in that area. A mouseclick sets (L:Lights, bool) to 1, another click sets it back to 0, etc.The answer is already in the code, really.Another suggestion for worthwile reading is the XML FAQ at the top of this forums front page.grtWillem.

Share this post


Link to post
Share on other sites

OK, I understand most of it now and I think I understand this part ' (>K:STROBES_TOGGLE)(>K:TOGGLE_BEACON_LIGHTS) 'When you put 2 variables ( I think that's what they're called ) next to each other with '>' in their names, will it activate both of them? Is that the way of telling fs9 to activate both of them?Also, instead of putting them 2 variables, what should I put to make all of the pushbutton lights illuminate?Will I need to add '' in there because this is part of the light test gauge for the other aircraft: (L:DC_ESS_Bus,bool) (L:LTest,bool) &I'm particularly interested in the '&' part because 'amp' is a unit for electrical current in the sdk.You've been very helpful so far, thanks very muchKind RegardsJonathanhttp://i533.photobucket.com/albums/ee331/i...m/signature.jpg

Share this post


Link to post
Share on other sites

Hi,(>K:xxxx) (>K:xxxx) tells FS to execute those events.There could as well be only one (>K:xxxx), or multiple of those, or none but an L:Var that gets its value toggled.For your purpose i don't believe there is any stock eventid. I think you need to use an L:Var to control the visibility of the light bitmaps.I explained already above how to do that.(L:DC_ESS_Bus,bool) (L:LTest,bool) &Means that Lighttest_on.bmp is visible when both L:Vars (L:DC_ESS_Bus, bool) and (L:LTest, bool) return a value of 1.& has nothing to do with the unit amps...&& means AND.As you can see the DC_ESS_Bus, bool is an L:Var so it is user defined.I didn't check but it would be plausible if this variable gives a 1 if the dc essential bus is powered and a 0 if it is not. A bool is limited to a 0 or a 1 value meaning no or yes.No light test possible if there is no electrical power available.Just start at the basics and learn how to show and hide a bitmap by clicking on a gauge. It is explained above how to do that, with some thinking from your part needed of course...grtWillem

Share this post


Link to post
Share on other sites

>Hi,>>I want to make a gauge that toggles every switch light on the>panel and overhead, how can I do this? I am having problems>with things like (L:...) and can someone tell me what '& amp'>means?& is simply "and"The ampersand symbol is '&' but in the XML schema it is reserved for special use.The "amp;" means '&'You can actually use any of the following interchangably:&&∧

Share this post


Link to post
Share on other sites

Have been on vacation for the past 3 weeks...No internet does seem like a blessing at times i tell you.You could for instance have an L:var that is set to a certain value when the lighttest is activated.In each pushbutton switch you can then check if that L:Var is that value after which would it then show both on an off lights bitmaps in that pushbutton. Or maybe use a single bitmap that has both lights in it already (as i suspect your lighttest_on.bmp would look like).This is one possible way of doing it i think.There might be many other solutions to this.grtWillem

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.