Archived

This topic is now archived and is closed to further replies.

Odaat

Simple Select Case XML Code Help Please

Recommended Posts

I've done several searches in this forum to find an example of what I am trying to do, but I've not found a working solution. Here is my code:

			<Element>				<Select>				<Value>(A:NUMBER OF ENGINES, NUMBER)</Value>				<Case Value="1">1 (>G:Var1)</Case>				<Case Value="2">2 (>G:Var1)</Case>				<Case Value="3">3 (>G:Var1)</Case>				<Case Value="4">4 (>G:Var1)</Case>				</Select>				<Position X="180" Y="180"/>				<FormattedText X="150" Y="16" Bright="Yes" Length="150" Font="Arial" FontSize="14" LineSpacing="16" Color="#CD8DC5">				<String>Number of Engines: %((G:Var1))%!d!%</String>				</FormattedText>			</Element>

All I'm trying to do at this point is to get my code to show the number of engines detected on the airplane. Right now, the gauge shows 0 where I am attempting to display the # of engines. Thank you.

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Try <Element> <Position X="100" Y="180"/> <Text X="150" Y="14" Bright="Yes" Length="150" Font="Arial" Color="#CD8DC5"> <String>%Number of Engines: %((A:NUMBER OF ENGINES, number))%!d!</String> </Text> </Element>

Share this post


Link to post
Share on other sites
Try <Element> <Position X="100" Y="180"/> <Text X="150" Y="14" Bright="Yes" Length="150" Font="Arial" Color="#CD8DC5"> <String>%Number of Engines: %((A:NUMBER OF ENGINES, number))%!d!</String> </Text> </Element>
Yes, I know this will work, thank you. This is more an exercise in learning how to write a select case. I want to add more code for each case once I understand the basic syntax of the select case.

Share this post


Link to post
Share on other sites

After spending some more time in the SDK, I determined how to do what I was trying to do with a case:

<String>%Number of Engines: %(4 3 2 1 0 5 (A:NUMBER OF ENGINES, NUMBER) case) %!d!</String>

Share this post


Link to post
Share on other sites