XML guru's, a little help?

This is the place where we can all meet and speak about whatever is on the mind.
new reply
maddz
Senior Airman
Posts: 202
Joined: 30 Aug 2010, 09:47

XML guru's, a little help?

Post by maddz »

I've made a temp gauge useing xml. Im trying to make the gauge peak when i switch on the test mode for checking lamps ect.
i have this :


-<Image Name="tempneedleWindow.bmp" PointsTo="North">
<Axis Y="69" X="2"/>
</Image>
-<Rotate>
<Value Maximum="60" Minimum="-40">(L:CabinTemp,Celsius) </Value>
-<Failures>
<SYSTEM_ELECTRICAL_PANELS Action="-40"/>
</Failures>
-<Nonlinearity>
<Item Y="79" X="31" Value="-40"/>
<Item Y="60" X="56" Value="0"/>
<Item Y="60" X="75" Value="14"/>
<Item Y="79" X="138" Value="60"/>
</Nonlinearity>
<Delay DegreesPerSecond="10"/>
</Rotate>
</Element>

The Lvar for the test switch is

<Value> (L:TestMasterSwitch) </Value>
Whitch returns values of 0,1 and 2. Im useing the value 0 to illuminate the lamps on my gauge.

Something like ; if {(L:TestMasterSwitch) 0 then (L:CabinTemp,Celsius) 60 else (L:CabinTemp,Celsius)......
(if test switch is is turned on,then set temp gauge to 60 (peak), otherwise return (L:CabinTemp,Celsius) value.

Just not sure how to write the above in XML language. Can anyone help?

Thanks

User avatar
crippy
Staff Sergeant
Posts: 268
Joined: 20 Feb 2017, 13:55
Location: Arkansas

Re: XML guru's, a little help?

Post by crippy »

Hey maddz, I am currently in the same boat (kind of) as you. I've been working on a tug XML gauge. While I don't have an exact answer for you, here is an IF statement with a nested IF too, from an open source tug gauge I found over at FSDeveloper.com - I also recommend maybe posting this question over there, as they might be able to answer this too.

Here is the example XML IF statement with a nested IF.
*Keep in mind this code is not my own, nor am I claiming it to be my own.

**note indents don't work on the forum, so it is slightly harder to read
<Click>(A:SURFACE RELATIVE GROUND SPEED,Knots) 0.1 <
if{ (L:TD_Fwd_Rev,Number)
if{ (L:TS_Speed,Knots) 0.5924838 / (>K:KEY_TUG_SPEED) (L:TD_Direction,Degrees) 11930465 * (>K:KEY_TUG_HEADING) }
els{ 1 (>K:TOGGLE_PUSHBACK) (L:TD_Direction,Degrees) 11930465 * (>K:KEY_TUG_HEADING) }
} els{ (L:TD_Direction,Degrees) 11930465 * (>K:KEY_TUG_HEADING) }</Click>


Hope it helps! I myself am trying to get used to XML for some personal P3Dv4 projects including a personal tug replica, but my free time to research and play around is severely limited.
Image Image Image
3D Lights Redux | Accu-Feel v2 | J-3 Cub | P-51C | T-6 Texan | B17 | L049 | Cherokee 180 | Comanche 250 | 172R Skyhawk | 182T Skylane

maddz
Senior Airman
Posts: 202
Joined: 30 Aug 2010, 09:47

Re: XML guru's, a little help?

Post by maddz »

Hey Crippy,

Thanks for the reply, although the code you posted is above my level of understanding :D
I've currently just spent the weekend reading XML tutorials and old forum posts and im not really any further on :mrgreen: im ok with simple stuff but having to link things i struggle with :?
I picked up a some neat tricks though so worth it.
Im slightly further on with the test mode but its still not working correctly.

I used a screw on the guage face as a click spot for the ''test'' button, then, useing code from an old forum post, and modifying the L:vars to suit, got some life from the guage needle

As follows:

<Mouse>
<Area Left="20" Right="28" Top="128" Bottom="144">
<Tooltip ID="Test"/>
<Cursor Type="Hand"/>
<Click Kind="LeftSingle+Leave">(M:Event)(L:CabinTemp) 22 <= if{ 60 } els{ -40 } + -40 max 60 min (>L:CabinTemp)
</Click>
</Area>
</Mouse>

When i press the test button, the needle seems like its trying to go up, but something is holding it back..but eventually, it will peak.but just very jerky to do so.

Alternativly, i've added another Lvar to the needle <value> ( excuse my phraseology :D ) like so :

<Element>
<Position X="78" Y="122"/>
<Image Name="tempneedleWindow.bmp" PointsTo="North">
<Axis X="2" Y="69"/>
</Image>
<Rotate>
<Value Minimum="-40" Maximum="60">(L:CabinTemp,Celsius) + (L:TestMasterSwitch)+ 100 min</Value>
<Failures>
<SYSTEM_ELECTRICAL_PANELS Action="-40" />
</Failures>
<Nonlinearity>
<Item Value="-40" X="31" Y="79"/>
<Item Value="0" X="56" Y="60"/>
<Item Value="14" X="75" Y="60"/>
<Item Value="60" X="127" Y="78"/>
</Nonlinearity>
<Delay DegreesPerSecond="10"/>
</Rotate>
</Element>

With that added to the equation, when i select the test switch (Im refering the the connie flight engineer test switch) in the cockpit position (switch down, lvar output value '0' ) the needle will drop just a few degress. With the test switch in the off position, the needle reads true (Lvar output value '1' ) and with the switch in the engineer panel test light position (Lvar output value '2' ) the needle will INCREASE by a few degrees..so some how ive got to learn how to interpet the code the i used, and modify it for better results. Thing is i dont know where to start with : ''(L:CabinTemp) 22 <= if{ 60 } els{ -40 } + -40 max 60 min (>L:CabinTemp)'' and the likes...i've looked but cant find a tutorial that explains this kinda stuff in lamen terms..

'!'
"=="
''els''
''if''
''>''
''{}''
''*''
ect
ect

Im not able to find much that axplains those kinda things
Also, im reading tutorials designed for fs9 gauges, although so far hasn't been a problem with the others ive made useing this way.

The ivestigation / learninig curve goes on...but the spare time doesnt.. :mrgreen:

maddz
Senior Airman
Posts: 202
Joined: 30 Aug 2010, 09:47

Re: XML guru's, a little help?

Post by maddz »

To finish up, with a little help from other forums, the test mode now works.

the string :

<Value Minimum="-40" Maximum="60">(L:CabinTemp,Celsius) + (L:TestMasterSwitch) 1 == if{ (L:CabinTemp,Celcius) } els{ 60 }</Value>

Thanks

new reply

Return to “Pilot's Lounge”

Who is online

Users browsing this forum: No registered users and 80 guests