XML gauge code woes

A quiet place for budding model makers to share thoughts, get answers to questions and request and share references.

Moderators: Guru's, The Ministry

delticbob
Concorde
Concorde
Posts: 682
Joined: 19 Aug 2005, 19:15
Location: Doncaster. UK

XML gauge code woes

Post by delticbob »

What a performance :'(

If there are any panel gauge designers here who would give me a hand :thumbsup: I'd be most grateful.

I have never got my head round this XML lark & now I'm going in circles.

Basically I have made two bmps - only small, that depict a tail parachute deployment switch - in & out, (or up & down in the panel)! Should be a three way switch, but the mid psoition does nothing so I've ommitted it.

I have (erm...copied B)smk ) some xml code from another gauge (from another plane) & tried this.

My gauge animates super, but does not deply the tail chute - which I nealy forgot to add is connected to the Wings fold/unfold key.

I have had another twiddle & now the switch does deploy the chute & retracts it again but :help: now the animation on the switch doesn't :hide:

Oh, & the switch is for the old tin triangle from Just Flight - FS9 version.

I am lost reading about bools, & parameters & elements :$ so any good pointers would halp restore my sanity.

Ta muchly

Bob
I can fly now with my fantastic new PC

User avatar
Chris Sykes
Concorde
Concorde
Posts: 1658
Joined: 18 Apr 2006, 11:50
Location: Northampton

Re: XML gauge code woes

Post by Chris Sykes »

Hi Bob,

You may want to take a ponder at my "Exit Guage" i made some time ago as IIRC it has a wingfold function in the gauge... When im home ill see if i can dig around and just make it the Wingfold part only...

Chris

delticbob
Concorde
Concorde
Posts: 682
Joined: 19 Aug 2005, 19:15
Location: Doncaster. UK

Re: XML gauge code woes

Post by delticbob »

Thaks for the offer Chris.

After you comment above I diwnloaded the gauge (from Simviation) & had a ply with the code :(( I'm still non the wiser & can still get the gauge clickable to deploy retract the chute, but still no animation to the switch.

The bmps are 57 x 69 & 24 bit (as is the main bmp). I was for a moment thinking that of the main bmp was still 8 bit, if the was going to be a clash.

The 2 bmps are actually just slightly too big & need shrinking a small amount but if they don't work now I don't think reducing them a small amount would make any difference.

Thanks anyway.

Bob
I can fly now with my fantastic new PC

User avatar
Chris Sykes
Concorde
Concorde
Posts: 1658
Joined: 18 Apr 2006, 11:50
Location: Northampton

Re: XML gauge code woes

Post by Chris Sykes »

The image sizes wont change anything int he gauge workings, except where the mouse click is and poss animations...

User avatar
Viscount Cornbank
The Gurus
Posts: 1119
Joined: 29 Jun 2004, 12:29
Location: Cornbank House, rural Scotland

Re: XML gauge code woes

Post by Viscount Cornbank »

Hi Bob,

Which variable were you using originally for the switch, before it stopped working?

This is a similar setup to that which operated the swingtail on the CL-44.

You could animate the switch thus: (adjusting the names for your own artwork)

<Element>
<Position X="11" Y="349"/>
<Select>
<Value Minimum="0" Maximum="1">(L:Brake_Parachute_Switch,number)</Value>
<Case Value="0">
<Image Name="Toggle_Switch_UP.bmp"/>
</Case>
<Case Value="1">
<Image Name="Toggle_Switch_DOWN_bmp"/>
</Case>
</Select>
</Element>


And the mouse entry thus: (adjusting the coordinates to suit)

<Area Top="31" Left="57" Right="100" Bottom="56">
<Cursor Type="Hand"/>
<Click>(L:Brake_Parachute_Switch, number) ! (>L:Brake_Parachute_Switch, number) (L:Brake_Parachute_Switch, number) 1 == (A:Folding Wing Left Percent,percent) 1 < && if{ 0 (>K:TOGGLE_WING_FOLD) } (L:Brake_Parachute_Switch, number) 0 == (A:Folding Wing Left Percent,percent) 0 > && if{ 0 (>K:TOGGLE_WING_FOLD) }</Click>
<Tooltip>Brake Parachute</Tooltip>
</Area>


In this scenario, the parachute would deploy with the switch down. ;)

cheers

Fraser
Image

delticbob
Concorde
Concorde
Posts: 682
Joined: 19 Aug 2005, 19:15
Location: Doncaster. UK

Re: XML gauge code woes

Post by delticbob »

Well :doh: :wall:

Thanks to both Chris & Fraser.

The state of play in this. I've had another play with the code - see below, using the above posted by Fraser as a jumping off point.

The gauge now animates as it should & controls the windfold as it should, & deploys the tail chute..... :( However, when the wingfold key is pressed, (I have it on the 'K' key), this also operates the wingfold function but does not have any tie-in with the now operating switch. e.g. the new switch is working as a two way electrical switch, in that irrespective of the position of the switch animation it will action the opposite of the action of the 'K' key. If you understand that.

The code I have now got [half] working - which I am pleased about non the less, is:-

Gauge Name="Vulcan_Tail_Chute" Version="1.0">
<Element>
<Position X="0" Y="0"/>
<Select>
<Value Minimum="0" Maximum="1">(L:Brake_Parachute_Switch,number)</Value>
<Case Value="0">
<Image Name="Toggle_Switch_2.bmp"/>
</Case>
<Case Value="1">
<Image Name="Toggle_Switch_1.bmp"/>
</Case>
</Select>
</Element>
<Mouse>
<Cursor Type="Hand"/>
<Click>(L:Brake_Parachute_Switch, number) ! (>L:Brake_Parachute_Switch, number) (L:Brake_Parachute_Switch, number) 1 == (A:Folding Wing Left Percent,percent) 1 < && if{ 0 (>K:TOGGLE_WING_FOLD) } (L:Brake_Parachute_Switch, number) 0 == (A:Folding Wing Left Percent,percent) 0 > && if{ 0 (>K:TOGGLE_WING_FOLD) }</Click>
<Tooltip>Brake Parachute</Tooltip>
</Mouse>
</Gauge>


where switch 2 is the 'up' position & removes the shoot, & switch 1 is the 'down' position & deploys the shoot.

I'm getting there, but I think it might be another 4 years before I try another one :guinn:

Bob
I can fly now with my fantastic new PC

tedcook
Chipmunk
Chipmunk
Posts: 4
Joined: 15 Dec 2007, 14:23
Location: Stoke on Trent, England.
Contact:

Re: XML gauge code woes

Post by tedcook »

Bob
If you only have a two position switch then it is better to use a 'bool' unit since I believe that the ' ! ' operator only works reliably on boolean values.

The TOGGLE key values also only have two possible values and so you do not need to insert any yourself - ie. the 0 is defunct in
'if{ 0 (>K:TOGGLE_WING_FOLD) }'

(L:Brake_Parachute_Switch, number) ! (>L:Brake_Parachute_Switch, number) (L:Brake_Parachute_Switch, number) 1 == works but -
It can be rewritten as (L:Brake_Parachute_Switch, number) ! d (>L:Brake_Parachute_Switch, number) 1=
The d, for duplicate, which means that you do not have to re-interrogate Flight Sim for the value that precedes it. [ = faster/ more efficient]

So you end up with the following:-

Code: Select all

Gauge Name="Vulcan_Tail_Chute" Version="1.0">
    <Element>
        	<Position X="0" Y="0" />
	<Select>
	    <Value>(L:Brake_Parachute_Switch,bool)</Value>
	    <Case Value="0">
		<Image Name="Toggle_Switch_2.bmp" />
	    </Case>
                 <Case Value="1">
		<Image Name="Toggle_Switch_1.bmp" />
	    </Case>
	</Select>
    </Element>

    <Mouse>
	<Cursor Type="Hand"/>
	<Click>(L:Brake_Parachute_Switch,bool) ! d (>L:Brake_Parachute_Switch,bool) 1 == (A:Folding Wing Left Percent,percent) 1 < && 
    	    if{ (>K:TOGGLE_WING_FOLD) } (L:Brake_Parachute_Switch,bool) 0 == (A:Folding Wing Left Percent,percent) 0 > &&  
    	    if{ (>K:TOGGLE_WING_FOLD) }
	</Click>
	<Tooltip>Brake Parachute</Tooltip>
    </Mouse>

</Gauge>
Remember that all (L:----,---) variables initialise at 0 [zero]

Regards, Ted.

User avatar
DaveB
The Ministry
Posts: 30457
Joined: 17 Jun 2004, 20:46
Location: Pelsall, West Mids, UK
Contact:

Re: XML gauge code woes

Post by DaveB »

Hi Ted :hello:

Tks for dropping that in. Nice to see you out and about ;)

ATB

DaveB B)smk
ImageImage
Old sailors never die.. they just smell that way!

User avatar
DelP
The Gurus
Posts: 2243
Joined: 16 Aug 2004, 21:40
Location: Under EGCC 23R approach....

Re: XML gauge code woes

Post by DelP »

Nice to see you Ted ;)

I'm moving this to Developers' Corner because:

a) That's where this topic belongs....

b) I work a late shift, so after doing housework at stupid o'clock in the early hours I thought I'd tidy this up as well :lol: :lol: :lol:

ATB,

Derek :D
'My Auntie Mabel told me I'd make a great soldier, though I don't know how 30 years working in a biscuit factory had qualified her to make that judgement.....' Eddie Nugent

Airborne Signals

delticbob
Concorde
Concorde
Posts: 682
Joined: 19 Aug 2005, 19:15
Location: Doncaster. UK

Re: XML gauge code woes

Post by delticbob »

DelP wrote:
I'm moving this to Developers' Corner because:

....That's where this topic belongs....
Derek :D

Thats for that - I didn't think when I forst posted :((

Quick update. Thanks to Ted & Fraser for their help :hide: sadly to no avail. I'm not throwing it back in your faces, far from it, but I am still having the same issue outlined above, i.e. the switch works but independently of the key stroke, but as I till have other bits on the go I'm not worried. I need to read up abit more on XML coding. I have the FS2004 panel SDK installed & it might as well by in Chinese.

Thanks again chaps & I take my hat off to you for the work you do - that the rest of us take for granted.

Bob
I can fly now with my fantastic new PC

Post Reply