Jump to content
Sign in to follow this  
Guest grimmy69

xml switch for smoke pods

Recommended Posts

Guest grimmy69

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
Guest grimmy69

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
Guest grimmy69

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
Guest grimmy69

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
Guest grimmy69

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
Guest grimmy69

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
Guest grimmy69

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
Guest grimmy69

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
Guest grimmy69

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
Guest grimmy69

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
Guest grimmy69

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

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...