Sign in to follow this  
Guest

.xml switch backgrounds

Recommended Posts

I have a question concerning .xml gauges... I'm a long-shot novice when it comes to computer coding, so I'm not sure how to go about my challenge. I've been able to adapt some .xml switches and knobs to my panel and I'm wanting to add static backgrounds to several of them that will provide "backlighting" to the text of the associated switch or knob that it is assigned to. For instance; with the autopilot panel, I'd like to backlight the text that appears with the switchs and knobs, just like the real thing. However, I do not want the mouse-cursor to activate when I drag it over the switch's background bitmap... only when I drag it over the switch bitmap itself. In other words, I've presently had success in being able to provide this backlighting for a switch, only what occurs is that I'm able to still operate the switch even while the cursor isn't completely over the switch itself, because the coding thinks that the background bitmap (the backlighting) it the entire switch. This can be pretty annoying, especially if you have another switch in close proximity to it, just like an autopilot panel has. I want to do the same thing with all my other Auto-pilot switches and adjusting knobs, and I'm hoping someone can help me to solve the .xml coding structure for me to do this and allow me to make the background for them "static" and non-functional. Any help that someone might provide would be greatly appreciated. Regards,Kevin Sparkuhl

Share this post


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

Here's a screenshot of my panel to this point...

Share this post


Link to post
Share on other sites

One way to do this is exampled by the code below. A backround is produced without the lettering. (NWS_BG.bmp) Then a lettered bmp (NWS_BG_Bright.bmp) is placed over the top controlled by a value, in this case (L:VarBRIGHT, bool), but could be whatever you'd like. The only difference is the "bright" tag embedded within the image attributes, when case = 0 the attribute of bright = "No" otherwise when it = 1 the attribute of being bright = "yes". BTW the lettered bitmap is all 0,0,0, other than the letters itslf. This way is easiest for the "artistically challenged" as the bright and non bright bitmaps are the same. The other way to do this is to have a bitmap with the full bitmap ( including backround lettering) to be fully visible at all times. Then having an exact bitmap of the lettering 'only' matching the first bitmap to be shown when only when the value of being bright = 1. (for the artistically unchallenged) LOL !!!!The latter is the best way.(L:VarBRIGHT, bool)Regards,Roman

Share this post


Link to post
Share on other sites

Howdy Roman,Long time no seeing, how is life?So what will you assign the L-varBright with?BrgdsEugen

Share this post


Link to post
Share on other sites

Thanks Bill...You're absolutely right... it would be easier to do it the way you suggested. As a matter of fact, I was in the process of creating a new post on this same subject when you posted your response here! lol Great minds think alike... Now all I need is a way to be able to do this. Any suggestions? Like I mentioned earlier, I'm new to this .xml code, so I'm learning as I go. Something like this would be easy and old hat to a pro, and I'm hoping one of them would be so kind as to point me in the proper direction in how to go about it.Thanks again!Kevin

Share this post


Link to post
Share on other sites

>Now all I need is a way to be able to do this. Any>suggestions? Like I mentioned earlier, I'm new to this .xml>code, so I'm learning as I go. Something like this would be>easy and old hat to a pro, and I'm hoping one of them would be>so kind as to point me in the proper direction in how to go>about it.You can use the same code that was posted already, but I'd change this one line:(L:VarBRIGHT, bool)to(A:Panel Lights,bool)so that the text would be illuminated whenever the panel lights are switched on. If you want to get "fancy," you can duplicate the portion above and use the Luminous="Yes" tag in place of the Bright="Yes"That way you'd have three levels of lighting:OFFDIMBRIGHTThe Element section with the Luminous tag would be controlled by a separate bright/dim switch that used a custom variable like the one in the example above.The logic would be:If L:VarBRIGHT,bool = 0 AND A:Panel Lights,bool = 0 THEN OFFIf L:VarBRIGHT,bool = 1 AND A:Panel Lights,bool = 0 THEN USE LUMINOUS TAGIf L:VarBRIGHT,bool = 1 AND A:Panel Lights,bool = 1 THEN USE BRIGHT TAGNote: the above is NOT XML code, but simply illustrates the logic switching... :)BTW, you can use the same "trick" within the instrument gauges as well, which really looks COOL! :)BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Share this post


Link to post
Share on other sites

The reason there was a L:VarBRIGHT, bool was because there were a total of 4 separate light circuits. A:Panel lights, bool was for flood, L:VarBRIGHT, bool was for main instrument panel bacround lighting, L:VarBRIGHTU, bool for upper panel and L:VarBRIGHTL, bool for pedestal lighting..All in all same principal and... " >>BTW, you can use the same "trick" within theinstrument gauges as well, which really looks COOL! :) << "Yep it sure does :-)Regards,Roman

Share this post


Link to post
Share on other sites

Bill...Thanks for the help! I've used the Luminous tag and it sure does look great! Check out the screenshot...! I'm not sure about applying it to the gauges yet, but I'm sure I'll be experimenting with it real soon.I like the idea for the 3-way switch that you mentioned... I've got just the place for it. I can do on-off switches, but I have yet to be able to produce a three-way switch that actually works. I'm not sure as well which values to apply for this and click events that would need to be used... so if you have a "blueprint" type of code I could borrow on for such a task, it would help tremendously. Like I said, with every new task I perform, I'm learning!Do you have any suggestions for an easy way to do light splashes on the panel? Nothing too dramatic... just a hint of light coming from the panel light housings.Thanks again for all the assistance thus far!Regards,Kevin

Share this post


Link to post
Share on other sites

Thanks Roman! The code worked great!! Check out the screenshot in the post above...Kevin

Share this post


Link to post
Share on other sites

Hi,Something like this not tested.....BrgdsEugen(L:737NG Switch, enum) (*left*)(L:737NG Switch, enum) -1 != if{ (L:737NG Switch, enum) 1 - (>L:737NG Switch, enum) } (*right*)(L:737NG Switch, enum) 1 != if{ (L:737NG Switch, enum) 1 + (> L:737NG Switch, enum) }

Share this post


Link to post
Share on other sites

>Do you have any suggestions for an easy way to do light>splashes on the panel? Nothing too dramatic... just a hint>of light coming from the panel light housings.>>Thanks again for all the assistance thus far!You are most welcome. I notice that the 'code' for a three-way switch was already posted, so I'll tackle this one... :)I assume that you're asking about the 2d panel, since that appears to be what you're working on, so you might simply use a bitmap swap. Set up an alternate bitmap with the "light splash" and switch between the two in the same code with your panel lights. Alternatively, you can create a transparent 'overlay' gauge which does nothing more than add a "light splash" to the existing panel bitmap. Try both ways and decide which is easiest for you.BTW, your panel is looking really good! :)BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Share this post


Link to post
Share on other sites

Bill...Transparent overlay?? Gee... Can you guess my next question!?! : )How does one go about doing THAT? It would be perfect!BTW... The backlighting text appears all the time, it works (off during the day, and on during the night) and I cannot seem to make it go away during the day... I've tried to make Value-1 a background value of 0,0,0, and it goes away, but when I turn the panel lights on, it doesn't show up. Here's the code I'm using... (A:Panel Lights,bool)I've tried to make Value-1 Luminous="No" and the lighting still comes on, and also, as I explained above, I've tried to make the Value-1 image, "LtsBkgrndDark.bmp" which is a 0,0,0 bitmap, to no avail.Thanks again Bill... hope all is well for you.Kevin

Share this post


Link to post
Share on other sites

New Question...How does one go about making a .wav file play when activating a toggle or switch, for instance a "click" sound for a switch, or an "air-conditioner" .wav that will repeat-playback for an A/C switch? Any ideas for me?Kevin

Share this post


Link to post
Share on other sites

Hi,First you need the WHM-kevents.gau and the XMLsound.gau.Then you can add the >K:TOGGLE_AFTERBURNER(1-4)events in the click-code.Take a good aircosound and rename it to, say, whm-sound1 (or 2, 3, 4).Then put the following code in your "airco-gauge":............(L:airco,enum) 1 == if{ (>K:TOGGLE_AFTERBURNER1) }.............(L:airco,enum) ! (>L:airco,enum) 1 (>K:TOGGLE_AFTERBURNER1)..............Works fine for me. Jan"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