Jump to content
Sign in to follow this  
Guest A320 Co-Pilot

L: variable string increase and decrease via mouse click

Recommended Posts

Guest A320 Co-Pilot

I am making a gauge that you can set the V1 Rotate and V2 speeds into. The idea is that you set your VSpeeds in the correct boxes and when the airspeed and L:Variable are the same it will play the correct sound ie V1, Rotate etc. I am going to use L: variable for the V1, Rotate and V2 speed, but have come up with a problem straight away, I will use a string for the speed numbers, then I need to be able to increase and decrese the numbers via an up and down click, but however hard I try I can not get it to work. This is what I have so far:(A:Circuit general panel on,bool)%((L:V1, knot))%!03d!(L:V1, knot) 0 > if{ (L:V1, knot) -- (>L:V1, Knot) }(L:V1, Knot) ++ (>L:V1, Knot) The background shows up with the string showing 000, but the mouse click spot do not show up at all.Can anybody help ?

Share this post


Link to post
Share on other sites

Hi,You can try this:(A:Circuit general panel on,bool)%((L:V1, knots))%!03d! (* Need to put this here *)(L:V1, knots) -- 0 max (>L:V1, knots)(L:V1, knots) ++ 999 min (>L:V1, knots) Hope this helpsTom

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

Thanks, Have tried the above code and with a little bit of alteration to the Area left, works perfectly.I do however have another problem, have used Doug Dawson XML sound gauge quite a lot, on my panel for the click sounds of the switches etc but have never used it for making a sound via an event, ie Airspeed Indicated, knots 80 > to play a sound file 80 knots. I have come up with this code and it does work, but the sound file keeps on playing, I only want it to play once when I reach 80 knots, I have looked all over the forum but can not find a post on how to solve this problem. I have tried adding another event to turn it off ie Airspeed Indicated 82 < if{ 1 (>L:FO_Sound_80,enum) but that just makes the 80 knots keep playing as soon as I turn on the takeoff switch. This is the code I am using to get the 80 knots to play when the airspeed is at 80 knots.(L:Takeoff,bool) if{ 1 (A:AIRSPEED INDICATED,knots) 80 > if{ 1 (>L:FO_Sound_80,enum) } } Thanks in advance for any help.

Share this post


Link to post
Share on other sites

Hi,Try:0.(L:FO_Sound_80,enum) 1 == if{ 0 (>L:FO_Sound_80,enum) }Or1.(L:Takeoff,bool) if{ (A:AIRSPEED INDICATED,knots) 80 == if{ 1 (>L:FO_Sound_80,enum) } els{ 0 (>L:FO_Sound_80,enum) } }Or2.(L:Takeoff,bool) if{ (A:AIRSPEED INDICATED,knots) s0 79 < l1 81 > and if{ 1 (>L:FO_Sound_80,enum) } els{ 0 (>L:FO_Sound_80,enum) } } Experiment with speeds.Or3.Download Rob's Vspeeds (rcbvs-24.zip)Contains very good code for Vref's and sound.Hope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

I have downloaded Rob's Gauge, but there are a lot of GVar in it and can never seem to see how they work.Have got the sound file to play only once using this: (L:Takeoff,bool) if{ 1 (A:AIRSPEED INDICATED,knots) near 78 == if{ (>L:FO_Sound_80,enum) } } now I have the job of getting my L Var for V1 and VR to play a sound file when the airspeed and the speed set in the L Var are the same.Thanks for the help so far.

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

Problems getting the L:Var and airspeed to work together.These are the codes which I thought might work but did not.(L:Takeoff,bool) if{ 1 (A:AIRSPEED INDICATED,knots) == (L:V1, knots) (>L:FO_Sound_V1,enum) } (L:Takeoff,bool) if{ 1 (L:V1, knots) == (A:Airspeed Indicated, knots) if{ 1 (>L:FO-Sound_V1,enum) } } (L:Takeoff,bool) if{ 1 (L:V1, knots) == if{ (A:Airspeed Indicated, knots) == if{ (>L:FO-Sound_V1,enum) } } } (L:Takeoff,bool) if{ 1 (A:Airspeed Indicated,knots) (L:V1, knots) && if{ 1 (>L:FO-Sound_V1,enum) } } (L:Takeoff,bool) if{ 1 (A:Airspeed Indicated,knots) (L:V1, knots) >= (L:V1, knots) < && if{ 1 (>L:FO-Sound_V1,enum) } } Any Ideas ?

Share this post


Link to post
Share on other sites

You're testing using the "equal to" comparison. The AIRSPEED INDICATED variable will very likely never be precisely equal to your L:V1 variable at a moment when the test is made.For example, 149.95 kts on one gauge update, 150.02 on the next. You just missed the test against 150 kts.You would be better testing for the first instance where AIRSPEED INDICATED exceeds L:V1. It is an easy enough matter to set a control variable which will prevent the sound from being played again until the gauge is reset.Doug

Share this post


Link to post
Share on other sites

Hi,Trying to trigger a sound once when the airspeed is EXACTLY a certain value is wrong approach, since you can never guarantee that this exact speed will ever be read. (because variables in FS are only written/read at discrete times, not contiguously).So assuming you want to play the sound once only, when the aircraft PASSES the specified speed in an increasing direction, use code like this:(L:Takeoff,bool)if{ (A:Airspeed Indicated, knots) (L:V1,number) > (L:PreviousReadAirspeed,number) (L:V1,number) < && if{ 1 (>L:FO-Sound_V1,enum) }}(A:Airspeed Indicated, knots) (>L:PreviousReadAirspeed,number)I.o.w:You trigger the sound when the current airspeed is > then V1 AND the previously read airspeed (in the previous gauge schedule) is < then V1.This will work under all circumstances.Cheers, Rob BarendregtPS: A small tip when you "name" your L:vars like L:Takeoff.Always make sure (or at least likely) that your L:var names are unique, so they will never conflict with L:Vars used in other gauges that might be added to that panel.EG. preceed the variable names with your initials or some other prefix. Like in (L:***_V1,number)**EDIT**: why does Doug always reply when I compose MY answer ...LOL

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

Hi I have now got the V1 and Rotate sound file to work with the above code, thanks Rob. Now I come to gear up, My idea for that is Radio Height 50 or greater, Vertical Speed 150 or greater, plays sound positive rate gear up, then gear lever is put into the up position.So if I use this code for the Gear Up, (Takeoff,bool) if{ (A:Radio Height, Feet) 50 > (A:Vertical Speed, Feet Per Minute) 150 > && if{ 1 if{ (>L:FO_Sound_PC,enum), but from experience of the 80knots code, I no this will play the sound continuously, so the first code I have tried is (Takeoff,bool) if{ 1 (A:Vertical Speed, Feet Per Minute) 150 > (A:Radio Height, Feet) near 55 == if{(>L:FO_Sound_PC,enumOn testing the above code using near, 3 out of 9 times I tested this, the Positive climb sound did not work, so need to be able to use > but how do you get it to play the sound only once ? I am proberly being thick, but have tried numours ways and the only way I can get it to only play once is by using near. I have looked at the code used for V1 and Rotate sound files to be played, but can not see how this can be used for the above problem.Thanks the Tip on naming L:var, If I can get this to work as I want it too, then I will be releasing it as a freeware gauge, so will alter the code accordingly. I will continue to play with the code, but any help on how to get a sound file to play once using > would be greatly appreciated.

Share this post


Link to post
Share on other sites

Hi,A condition to make sure that you only trigger a gear-up callout only once isn't that easy to create as for a Vspeed callout.In general, you have to "remember" that you have triggered the sound already. As Jan suggested in a previous answer: why don't you just try and understand the code in my rcbvs-24.zip upload ?? Because exactly those single-trigger problems are solved in there.In fact, I have the feeling that you are building a gauge that does the exact same things as my Vspeed.xml gauge, other than that in your gauge a user can set the Vspeeds himself instead of automatic calculation by the gauge. So what's the point in re-inventing the wheel :-) ??To help you understand my code: the G:Vars are just used to protect the callouts to be triggered only once, and are reset when the "takeoff" condition becomes false again after a takeoff.Rob PS: I have a new version of the same gauge that also gives flaps-retract callouts/confirmations when the aircraft exceeds a certain speed c.q. altitude after takeoff.

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

Hi RobI have used your code to get the positive climb sound file to work, so now I have a FO who calls 80 Knots, V1, Rotate and then Positive Climb and raises the gear.You are right our gauges are similiar so far, but I want mine to me more of a First Officer, At 500 Feet it will set Airspeed On, Heading Hold On and Altitude Hold On. Then using A:Decision Height as an unsed command I am hopeing that I can use this to get the FO to turn AP On and retract flaps when commanded to by the user. I am not sure if this is possible in XML and have not realy thought about the code I could use to get this to work, will have a search though the forum, and see if anyone has done anything like this.I must learn how G:Var work and how and when to use them, as I think this Gauge might need a few. Anyone know of a good tutorial on G:Var ?

Share this post


Link to post
Share on other sites

Take my advise, and forget about G:Vars.There's no advantage using them over L:Vars, other than typing less text (no need to specify a "unit").For the rest, G:Vars only have disadvantages, like the're being reset if you change from WindowedMode to FullScreenMode v.v.Unless you use that as a "feature" of course :-), or if you have a very specific reason to limit the scope of a variable to one "instance" of a gauge in the panel.Rob

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

HiThanks for the help Rob but I do not think that XML, can do what I want it to do. Having looked around the forum, I have found only one gauge that uses a joystick button to control it and that was via the parking brake being turn on and off. The decision height only uses a K event to increase it or decrease it, so after I tried a few different idea's I am beat. After Christmas I am going to see if I can learn C. From what I have read on the forum, it does look harder to master, but I at least in C I could get my gauge to work as I would like it too, and use key presses and joystick buttons to command a Virtual FO to do different things. It is a pitty that XML has so many limitations in this department. Has FSX got the same limitations using XML Programming ?

Share this post


Link to post
Share on other sites

<> Russell, I've read your posts and would like to say that yes, XML can perfectly do what you want to do and much, much more (no limitations whatsoever in these aspects)The point is, a bit of XML programming skill would be necessary to achieve your goal, pretty much the same as probably needed to make the code in C. I see you have some basic knowledge in XML that is indeed an advantage against the idea of learning C from scratch to make the gauge, then why not give another try searching for similar code's examples, complete gauges' examples or even asking here for help on precise points of your project?Just food for thought :-)Tom

Share this post


Link to post
Share on other sites
Guest A320 Co-Pilot

Hi Thanks for the Food for thought, I have decided to have one more go at creating this gauge in XML.The idea for the gauge is this. From a VSpeed table, I can find out the V1 and Rotate Speed of the Aircraft I want to use this for, I then enter the V1 and VR into the gauge. Then at 80 knots First Officer calls "80 Knots", at V1 FO calls "V1" and at VR FO calls "Rotate". Then when positive climb is achieved the FO calls "Positive Climb", Captain Calls "Gear Up" and FO rasies the gear. At 500ft FO engages Autopilot Heading On, Altitude On, and Airspeed On. 1000ft Captain (User) Turns on AP. Then at correct Flap retract speed via the press of a key or perfered joystick button, Captain (User) calls for the flaps to be retracted.I have managed to get the FO to call 80knot, V1 and Rotate at the speeds entered in to the gauge, then when positive climb is achieved FO calls positive climb, Captain Calls Gear up and the FO raises the gear. Then at 500ft FO engages AP heading, altitude and speed on. Now to the bit I have not got to work yet, I need to find a way to get a joystick button to be able to command a sound to play and get the FO to do the required task, ie flaps up to the next flap setting and then press the same button again at the correct speed to get the flap to up. Being an FS2Crew user Increase Decision Height (Concorde) is used as a main button, so as my Flight Yoke is configured to use a button for that command via the FS2004 assignment, so would like to use that.So I wil now ask for help on a precise point of my project, as so far I can not come up with a code which enables me to use Increase Desision Height (Concorde). So is there anyone out there with a better knowledge of XML who can help me come up with a code which uses Increase Decision Height (Concorde) as a button/key press that will enable me to command the FO to retract flaps ?

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