Sign in to follow this  
Guest grimmy69

xml switch for smoke pods

Recommended Posts

Hi!About two months ago, I started working on what then was just a simple repaint and translation of panels for FSQuality's SAAB105. The ambition was to make a Swedish version of it. It is a Swedish military aircraft originally, after all...Now, I have two repaints with two different panels. New flight dynamics adjusted for the weaker engines etc. I also have new effects for the nav lights and just last night I started trying to add a switch for turning on smoke pods for the aerobatic version. I have a XML-switch that works OK by adding a smoke fx to the beacon lights section in aircraft.cfg. However, this is a bit clumsy, since the smoke comes on if I turn on the lights by pressing "L".I am very new to XML and gauge programming, although I have worked with multimedia and web design for quite some time. Can anyone help me figure out a better way to do this? Can I hide the FX somewhere else, so I can trigger it by using a key that isn't used, like the water rudder or afterburner?Thanks,Roger

Share this post


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

I forgot to mention that there is a gauge that triggers contrails when the aircraft reaches 5g. That is why the smoke fx couldn't be added to the "smoke system" section on aircraft.cfg.

Share this post


Link to post
Share on other sites

Hi Roger,My first advise would be: don't use the L-key :-).. It's very unrealistic (never understood why this "all-lights" function is still available in FS).The only way to add user-controlled effects to aircraft, is by adding them to the SMokesystem (1 switch only) or Lightssection (10 different switches, with max. 19 entries), and control them via a gauge or XMLcode in the aircraft's .mdl. Now the second is not an option, because you use an existing aircraft model.Since you want to add Smoke, the most logical option would be: move the contrail to the Lights section (which means your contrail control gauge should be changed), and relate your smoke effect to the SmokeSystem. Controlled either by a panel switch, or the "I".Another possiblity (if you want the smoke effect to be controlled by the Beacon light): create a gauge that controlls the Beacon lightswitch dependant on the position of the panel switch.This means that, if your smoke panel switch is Off, and the user types L, (which enables the Beacon lights), the gauge immediately sets the Beacon lights Off again.But again, the first option would be the most logical one.NOTE: There's no way to prevent the L key (or a key/button asigned to BeaconLights) toggling the BeaconLights switch; you can CORRECT the switch position afterwards, either by continuously testing the Beacon light switch, or "trapping" the events that cause the BeaconLight switch to change.Cheers, Rob Barendregt

Share this post


Link to post
Share on other sites

Hi!Thanks for taking the time to think about my questions! I really appreciate it!I think I understand your solution. The contrails fx are set as beacons in the lights section and the smoke fx are set in the smoke system in aircraft.cfg.The G-smoke then regulates the beacon and the smoke fx is regulated by key "I" or the gauge switch I made.I am in over my head here...I tried to adjust the gauges, but I can't seem to make it work. It is difficult to find good material to read, so I'll paste the code I am using here, and see if you can help some more... ;)The G-smoke gauge:" (A:G force, gforce) 5 > if{ (>K:BEACON_LIGHTS_ON) } els{ (>K:BEACON_LIGHTS_OFF) } "and the Smokepod switch:"(A:Smoke,bool)Smoke Pods Switch(>K:SMOKE_ON)"Once again, thanks for helping out.

Share this post


Link to post
Share on other sites

You're using some unknown vars (at least, I use others).Just copy&paste the following: (not tested, but should work). (A:G force,gforce) 5 > if{ (A:LIGHT BEACON,bool) ! if{ (>K:TOGGLE_BEACON_LIGHTS) } } els{ (A:LIGHT BEACON,bool) if{ (>K:TOGGLE_BEACON_LIGHTS) } } (A:SMOKE ENABLE,bool)Smoke Pods Switch(>K:SMOKE_TOGGLE)Also note: if you place the gauges in a non-VC window (e.g. window00), you have to make the 2D cockpit visible at least ONCE after loading the panel, before the gauges are active..Cheers, ROb

Share this post


Link to post
Share on other sites

Thanks a million! It worked just perfect! You saved me a lot of headache...Now, I just have to pack everything up and upload it to a new servers...All the best,Roger

Share this post


Link to post
Share on other sites

In relation to the previous gauges... I would like to disable the smoke pods for some variants of the aircraft and I modified a small gauge so that it doesn't pump out any smoke at radar altitudes above 0. The problem is that there is a small puff of smoke before the gauge disables the smoke effects. Any ideas of a better solution? (A:Radio height, feet) 0 > > if{ (A:SMOKE ENABLE,bool) ! if{ (>K:SMOKE_OFF) } } els{ (A:SMOKE ENABLE,bool) if{ (>K:SMOKE_OFF) } }

Share this post


Link to post
Share on other sites

I don't know what you are trying to accomplish here, but I've never seen more errors in such a small piece of code :-) :- there's a > too many- the test on radio height is meaningless; RadioHeight is ALLWAYS > 0 (in fact always > a few feet: the aircrafts datum + landing gear height); so it's even aircraft dependant.- So the els{ clause is never executed.- And if it were, having Smoke_OFF in both if{ and els{ is pointless- The if{ clause will continuously give an Smoke_off command if smoke is allready Off, if smoke is turned on, it does nothing.So if you intention is to block the SMokesystem from EVER being turned on: (A:SMOKE ENABLE,bool) if{ (>K:SMOKE_OFF) } If you want the Smokesystem blocked ONLY when the aircraft is in the air, use: (A:SIM ON GROUND,bool) ! if{ (A:SMOKE ENABLE,bool) if{ (>K:SMOKE_OFF) } } Cheers, Rob

Share this post


Link to post
Share on other sites

heh, my appologies for the crappy code! :)I am in the middle of a thousand work projects and I really don't have much time to work with these gauges and learn XML right now. I simply copy code from other gauges and modify it, without fully understanding what I am doing... I have only a vague understanding of appropriate syntax and codes.The code I used above, works, but not as good as I want to. There are two different aircraft, one that has smoke pods. The problem is that they both use the same aircraft.cfg. Therefore they both share the same smoke system, which makes it possible to switch on the smoke pods on both aircraft, using "I".That is why I thought I would add a gauge on to the non-smoking aircraft that blocks the smoke system.I really wish I could find some good reading on this and really learn how to build XML-gauges from the ground up... Anyways, thanks again for helping out. I'll give it a try, when I get back from work!Best,Roger

Share this post


Link to post
Share on other sites

Hi again!I just tried the code you suggested and I get exactly the same results, a puff of smoke before it is cut off by the gauge. Seems it takes half a second for the gauge to respond to the keypress.Any ideas on how to make it respond quicker or maybe even block before the key is pressed? If I understand it correctly, it now activates right after the key is pressed.Roger

Share this post


Link to post
Share on other sites

In addition to the problem above, I am also having problems with the fuel cutoff switch below. It works, but the switch is instantly flipped back. Is the code faulty or is it likely to be another gauge that flips it back automatically?Thanks,Roger

Share this post


Link to post
Share on other sites

and the code...(A:General eng2 mixture lever position, percent) 1 > 2 *Low Fuel Pressure Switch0 (A:General eng2 mixture lever position, percent) 1 > if{ (>K:MIXTURE2_LEAN) } els{ (>K:MIXTURE2_RICH) }

Share this post


Link to post
Share on other sites

Ok, in response to my previous message...There are three gauges that are inter-connected; fuel boost pump switches, low fuel pressure switches and the warning panel.I disabled an auto-shutdown gauge which made the new "low fuel pressure" switch work OK.I know that the first two gauges manipulate roughly the same thing, but I need to adjust them to the following functions."Fuel boost pump" switches needs to be enabled at higher than 90 rpm's. The "low fuel pressure" switches should be enabled at all times and is also used to shutdown the engines.Both the fuel boost pump switches and the low fuel pressure has to be enabled to make the warning light switch off.Can anybody please help and teach me how to adjust the files?The code for the gauges is as follows:FUEL BOOST PUMPS:(L:FUELBOOST_L,bool)(L:FUELBOOST_L,bool) 0 == (A:TURB ENG1 N1, percent) 94 > && if{ (>K:MIXTURE1_LEAN) }(L:FUELBOOST_L, bool) ! (>L:FUELBOOST_L, bool)LOW FUEL PRESSURE:(A:General eng1 mixture lever position, percent) 1 > 2 *Low Fuel Pressure Switch0 (A:General eng1 mixture lever position, percent) 1 > if{ (>K:MIXTURE1_LEAN) } els{ (>K:MIXTURE1_RICH) }THE WARNING LIGHTS:(A:Fuel tank left main level,part) 0.02 < (L:FUELBOOST_L,bool) 0 == || if{ 1 (>L:LOFUL, numbers) } els{ 0 (>L:LOFUL, numbers) } (L:LOFUL, numbers)Thanks,Roger

Share this post


Link to post
Share on other sites

Also the warning light should come on if the fuel pressure is below a certain value, or if one the above mentioned switches are off.The aircraft has two engines, btw.

Share this post


Link to post
Share on other sites

Can't help you with the fuel gauges (I have no experiance there)Have you tried contacting the author of the gauges ??Quote from a previous message:""I am in the middle of a thousand work projects and I reallydon't have much time to work with these gauges and learn XMLright now. I simply copy code from other gauges and modifyit, without fully understanding what I am doing....""I'm sorry to say, that statements like these aren't very encouraging for people trying to help you solve a problem and learn from it.... I strongly suggest you either put some more effort in trying to learn XML, or stay away from making modifications in XML gauges without taking the time to properly understand what it does.That is, if you expect people here in this forum to help you ....And I've formulated this as mildly as I can :-)Regards, Rob

Share this post


Link to post
Share on other sites

I am really sorry if I offended someone by that quote! It really wasn't my intention. I've been working day and night for two months on what initally was only supposed to be a simple repaint, but due to requests has grown to a much larger project involving amongst other things, adjusted flight dynamics and new gauges. I am in contact with the author, but since he also works full-time as a flight mechanic, he is not always reachable.The last couple of weeks, I have searched the internet for good information on XML and FS, but I haven't found anything good. I have also searched all messages in this forum and others, trying to understand how the syntax and codes work. When I mentioned the time factor, it was simply a description of my situation. I am more than fully booked the next coming six months as a freelance designer. For this repaint I get requests that require me learning XML and I would like to accomodate the people asking for this, but since I have found no good information, it takes too much time right now. I really need a quick course in XML for panel design. Any suggestions on where I can learn more would be greatly appreciated! That is also the reason why I mentioned this wish in a previous message.I was also hoping to receive help to figure out these problems, and you definitely have helped me a lot. I hope I expressed my gratitude earlier, if not thanks! :)If anyone know of good links to learning XML in panel design, then please point me in the right direction. I am not giving up on this, especially not when it is so close to working.Once again, my appologies for sounding arrogant. It wasn't my intention.Thanks,Roger

Share this post


Link to post
Share on other sites

Hi Roger,No appology needed, also no offence felt by me.Just some factual advice :-)There simply is no quick-course in XML gauge design, like there is also no proper documentation (other than the events/variables like in the panel SDK); everyone just learns by doing and (I assume) has the same slow learning curve based on trial&error.If I were in your shoes (with obviously too much work committed), I'd try to team up with somebody that knows his way in XML design, to off-load some of the work. Which is a bit different approach to the problem you're facing :-)Not me by the way (too much work myself)Cheers, Rob

Share this post


Link to post
Share on other sites

Hi again!Thanks for responding!Teaming up with someone sounds like a good idea, but if that doesn't work out i'll try to finish it myself. There is really very little work left on the gauges, since they work satisfactory, although not perfectly.The repaint for FSQuality's SAAB 105 I started working on now contains three different exterior textures, new interior textures, new flight dynamics adjusted to the Swedish weaker engines and smaller fuel capacity, four different panels, new gauges and switches, new startup and shutdown procedures and finally, smoke pods for the aerobatics version. Also there are 10 differently textured AI-aircraft based on real aircraft, stationed at the four different airbases where they actually have been.Phew, this repaint kind of grew a bit and I've used all my spare time the last two months. My wife is now on the brink of murder, so I think I'll have to consider this finished now...If anyone, has any ideas on how to solve the problems mentioned above, I would be immensely grateful! All the best,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