• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSX Luminous, random values and String

Messages
51
Country
france
Hello everyone. I'm working on an XML gauge and I have several problems.

1) I have a text element and in spite of the Luminous="Yes" or Bright="Yes", the text is still dimmed.

Code:
<Element>
	<Position X="15" Y="22"/>
	<Text X="60" Y="55" Length="7" Font="Quartz" FontSize="60" Color="Green" Bright="Yes">
	<String>88</String>
	</Text>
	<Visible>(L:NumPrepVis, bool) 1 == </Visible>
</Element>

2) My gauge is meant to display an imprecise heading value that will be corrected after a procedure. For this I would like to add a random component (in a range) to the correct heading value and delete this component after the procedure.

Is there a way to create a random value in a range in XML ?

3) My gauge will display a mix of letters and numbers. Sometimes it will be an altitude or a heading but sometimes it will display a word and a value in the same element. I therefore need to convert the variables I want to display into string.

I found Macros in this topic : http://www.fsdeveloper.com/forum/showthread.php?t=94088

but I don't succeed in using it :

Code:
"tPF" (@ToString(A:PLANE ALTITUDE, Meters)) scat (>L:NumFenG)

...

<Element>
	<Position X="35" Y="2"/>
	<Text X="180" Y="55" Length="7" Font="Quartz" FontSize="60" Color="Green" Bright="Yes">
	[B]<String>%(L:NumFenG)%!s!</String>[/B]
	</Text>
	<Visible>(L:NumFenGVis, bool) 1 == </Visible>
</Element>

It doesn't work so I'm not using it properly. Can you see the errors ?


Thank you for the help :)
 
Last edited:
<String>%(L:NumFenG)%!s!</String>

should be:

<String>%(L:NumFenG,bool)%!s!</String>

Hope this helps,
 
Thanks for the help but doesn't work if I just add the unit. I got a "0." dipslayed instead of the string I want.

Even if I don't use strings, I have problems. Look at this example :

This works
Code:
<Element>
	<Position X="35" Y="2"/>
	<Text X="180" Y="55" Length="7" Font="Quartz" FontSize="60" Color="Green" Bright="Yes">
	[B]<String>%((A:PLANE LATITUDE, Radians) rddg @Random +)%!03.2f!</String>[/B]
	</Text>
	<Visible>(L:NumFenGVis, bool) 1 == </Visible>
</Element>

but this doesn't
Code:
[B](A:PLANE LATITUDE, Radians) rddg @Random + (>L:NumFenD, Degrees)[/B]

...

<Element>
	<Position X="35" Y="2"/>
	<Text X="180" Y="55" Length="7" Font="Quartz" FontSize="60" Color="Green" Bright="Yes">
	[B]<String>%((L:NumFenG, Degrees))%!03.2f!</String>[/B]
	</Text>
	<Visible>(L:NumFenGVis, bool) 1 == </Visible>
</Element>

I'm just puting the result into a variable but it displays "0.00" instead of the Altitude value
 
Last edited:
Is this calculation in an <Update> section? If not, it will never be evaluated...

Code:
<Update Hidden="Yes">
     (A:PLANE LATITUDE, Radians) rddg @Random + (>L:NumFenD, Degrees)
</Update>
 
Yes. :(

Code:
<Macro Name="Random">
	(E:Local time, seconds) 65326 * 1000 % 1000 / -1 *	
</Macro>
 
but this doesn't
Code:
[B](A:PLANE LATITUDE, Radians) rddg @Random + (>L:NumFenD, Degrees)[/B]

...

<Element>
	<Position X="35" Y="2"/>
	<Text X="180" Y="55" Length="7" Font="Quartz" FontSize="60" Color="Green" Bright="Yes">
	[B]<String>%((L:NumFenG, Degrees))%!03.2f!</String>[/B]
	</Text>
	<Visible>(L:NumFenGVis, bool) 1 == </Visible>
</Element>

I'm just puting the result into a variable but it displays "0.00" instead of the Altitude value

There are several issues here:

1) Your calculation creates a variable named (L:NumFenD, degrees) but you are trying to display a variable named (L:NumFenG, degrees). If you never defined (L:NumFenG, degrees), its value is 0.00 and that is what is displayed in your text element.

2) However, the value continuously changes with each update cycle. You may want to lock it in to just one "random" latitude, not a continuously changing latitude. In this case, you need to limit the calculation of (L:NumFenD, degrees) to occur in only one update cycle. This can be done using a mouse click to trigger the @Random, or a flag that is set in the update section after the @Random number is generated.

3) Your A:Var is PLANE LATITUDE and your units are radians and degrees, but you talk about displaying the ALTITUDE value. Assume that's a typo?

4) Instead of (A:PLANE LATITUDE, radians) rddg, why not simply use (A:PLANE LATITUDE, degrees)?

5) Your use of the string storing macro @ToString is incorrect. Those string store macros are used to "store" strings in xml by converting the characters into ascii equivalent numbers and storing the numbers. That does not look like what you are trying to accomplish, although I cannot be sure. If you really need to store string values, then that thread (or the wiki in this forum) is a place to start as it describes several approaches involving modules or macros, but read the docs carefully...

Cheers,

Bob
 
Last edited:
1) Oops sorry, I copied the wrong part of the code. :D
I want to create some data in an initialization section to display something on a right and a left text objects

In this code, the left text, i.e "(A:PLANE LATITUDE, Degrees) @Random +" is displayed correctly but I have a "0.000" instead of the right text, i.e. "(A:HEADING INDICATOR, Degrees)"

Code:
<Update ...>
(L:Init, bool) 0 == if{
                [B](A:PLANE LATITUDE, Degrees) @Random + (>L:NumFenG, Degrees)	[/B]		<!-- Left text -->
		[B][COLOR="Red"](A:HEADING INDICATOR, Degrees) (>L:NumFenD, Degrees)[/COLOR][/B]		<!-- Right text -->
		1 (>L:Init, bool)
}
</Update>

...

<Element> <!-- Right text -->
	<Position X="245" Y="2"/>
	<Text X="180" Y="55" Length="7" Font="Quartz" FontSize="60" Color="Green" Bright="Yes">
	[B][COLOR="Red"]<String>%((L:NumFenD, Degrees))%!03.3f!</String>[/COLOR][/B]
	</Text>
	<Visible>(L:NumFenDVis, bool) 1 == </Visible>
</Element>

<Element> <!-- Left text -->
	<Position X="35" Y="2"/>
	<Text X="180" Y="55" Length="7" Font="Quartz" FontSize="60" Color="Green" Bright="Yes">
	[B]<String>%((L:NumFenG, Degrees))%!03.3f!</String>[/B]
	</Text>
	<Visible>(L:NumFenGVis, bool) 1 == </Visible>
</Element>

BUT

If I just put the affectation out of my Init test, then it works... :confused:

Code:
<Update ...>
(L:Init, bool) 0 == if{
                [B](A:PLANE LATITUDE, Degrees) @Random + (>L:NumFenG, Degrees)	[/B] <!-- Left text -->
		1 (>L:Init, bool)
}
[B][COLOR="Green"](A:HEADING INDICATOR, Degrees) (>L:NumFenD, Degrees)[/COLOR][/B] <!-- Right text -->
</Update>

...

<Element> <!-- Right text -->
	<Position X="245" Y="2"/>
	<Text X="180" Y="55" Length="7" Font="Quartz" FontSize="60" Color="Green" Bright="Yes">
	[B][COLOR="Green"]<String>%((L:NumFenD, Degrees))%!03.3f!</String>[/COLOR][/B]
	</Text>
	<Visible>(L:NumFenDVis, bool) 1 == </Visible>
</Element>

<Element> <!-- Left text -->
	<Position X="35" Y="2"/>
	<Text X="180" Y="55" Length="7" Font="Quartz" FontSize="60" Color="Green" Bright="Yes">
	[B]<String>%((L:NumFenG, Degrees))%!03.3f!</String>[/B]
	</Text>
	<Visible>(L:NumFenGVis, bool) 1 == </Visible>
</Element>

2) Yep that's the goal of my init section. I don't know if it's the easiest way to do it but I can initialize some data in this test.

3) I'm just doing some tests to display strings, values in meters, in degrees...
When everything will work, I'll do the gauge correctly.

4) same answer, doing some tests

5 ) That's the important point ! I guess I went too fast. For the moment, I have different elements depending on what I want to display but I would like to make a unique string element that can display everything. I will read the doc more carefully before asking further questions.

6) While I'm here, I have random errors when using "AND" operators in my gauge. For instance, I have a if test like that : A B == C D == AND if{...}.
Sometimes it works ok, sometimes I have a "panel or gauge error" but it works if I click on Cancel and sometimes I have this error and the game crashes...
I verified a hundred times and the template of the test is the same.
Is there a problem using this kind of operator ?


Thank you for your help ! :)
 
Back
Top