Jump to content
Sign in to follow this  
Guest fullerjohn

Simple XML Monitor Gauge

Recommended Posts

Guest fullerjohn

Hi there. I'm new to writing XML Gauges and I am having trouble with one. I don't know if I am trying to do the impossible, but the idea seems easy enough! I have an aircraft with a refuelling probe which toggles with the Water_Rudder. On start-up of FS9 with this aircraft, the model's default is to have the Probe extended. Getting tired of having to retract it (either with Shift+W or with a mouse-click on a Panel Gauge I have written) before each take off, I thought I would write a "monitor" gauge that would constantly check the Probe's status and the aircraft's status (eg alt & airspeed lets say) and retract it if neccessary. I thought this would take a couple of mins to code, but I cannot trigger the "K" event! Can anyone tell me why the following simple, first try (just to get the Probe to retract whilst sitting on the runway after starting FS9) xml code does not work?<Gauge Name="CheckProbe" Version="1.0"> <Element> <Select> <Value>(A:WATER RUDDER HANDLE POSITION,PERCENT) 50 >(>K:TOGGLE_WATER_RUDDER, bool)</Value> </Select> </Element></Gauge>Is it possible to trigger events this way or must they be triggered only by keys or mouse clicks??Hope someone can help.John

Share this post


Link to post
Share on other sites

Two points:1. There is a dedicated forum here for Aircraft and Panel questions.2. XML formatting is critical, especially spaces! Also, you need to include the if{ } condition to evaluate your script...

<Value>	 (A:WATER RUDDER HANDLE POSITION,PERCENT) 50 >		 if{ (>K:TOGGLE_WATER_RUDDER) }</Value>

In pseudo-code:if (A:WATER RUDDER HANDLE POSITION,PERCENT) is greater than 50%, then trigger the (K:TOGGLE_WATER_RUDDER) event.However, this is a prime example of "bad code" since it will generate a continuously firing event as long as the condition listed is true. This in turn causes what we have termed a "race condition" which will interfere with other operations.It would be best to continue this in the appropriate forum if you wish.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest fullerjohn
Two points:1. There is a dedicated forum here for Aircraft and Panel questions.2. XML formatting is critical, especially spaces! Also, you need to include the if{ } condition to evaluate your script...
<Value>	 (A:WATER RUDDER HANDLE POSITION,PERCENT) 50 >		 if{ (>K:TOGGLE_WATER_RUDDER) }</Value>

In pseudo-code:if (A:WATER RUDDER HANDLE POSITION,PERCENT) is greater than 50%, then trigger the (K:TOGGLE_WATER_RUDDER) event.However, this is a prime example of "bad code" since it will generate a continuously firing event as long as the condition listed is true. This in turn causes what we have termed a "race condition" which will interfere with other operations.It would be best to continue this in the appropriate forum if you wish.

Hi and thanks for your reply. Sorry about the wrong forum - since this post I did look at the right forum and saw the post about a "timer code" required to achieve the above. I have now re-written the hidden gauge as follows:<Gauge Name="CheckProbe" Version="1.0"><Element><Select><Value>(A:WATER RUDDER HANDLE POSITION,PERCENT) 50 < (L:Water toggled,number) 0 <= (L:Dum1,number) ! && && if{ (>K:TOGGLE_WATER_RUDDER, bool) 3 (>L:Water toggled,number) } (L:Water toggled,number) -- (>L:Water toggled,number)</Value> </Select> </Element></Gauge>When I start FS9 with my plane, the above gauge closes AND LOCKS (Shift + W nolonger works) the probe in the closed position.I have another gauge in the cockpit which when clicked by the mouse unlocks and resumes normal OPEN/CLOSE function by means of the toggle event. With these two gauges, the probe starts in the closed position and my cockpit gauge opens/closes the probe whenever I wish!Here is the other "button push type" gauge code for completeness ( in case anyone else is in my position!):<Gauge Name="RefuelProbe" Version="1.0"> <Element> <Position X="0" Y="0"/> <Select> <Value>(A:WATER RUDDER HANDLE POSITION,PERCENT) 50 ></Value> <Case Value="1"> <Image Name="RFProbeIN.bmp" Bright="1"/> </Case> <Case Value="0"> <Image Name="RFProbeOUT.bmp" Bright="1"/> </Case> </Select> </Element> <Mouse> <Tooltip>Refuel Probe</Tooltip> <Cursor Type="Hand"/> <Click>1 (L:Dum1,number) ! (>L:Dum1,number) <-------this unlocks the probe ------> (>L:COP_ProbeSound,bool) ; (>K:TOGGLE_WATER_RUDDER, bool) </Click> </Mouse></Gauge>It always feeles great when I get XML coding to work! - thanks due to the info on this site, ofcourse.John

Share this post


Link to post
Share on other sites
It always feeles great when I get XML coding to work! - thanks due to the info on this site, of course.John
One more hint, John. When posting any "code" or "XML script" please wrap the example in the CODE tags to preserve the formatting.If you look at the toolbar icons above the text entry window, the CODE icon is the last one in the row. Highlight the code or XML script, then click on the CODE icon to wrap the selected text.Oh yes, and use the proper forum of course! :(

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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