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

Setting a local var value - vis and invis (xml)

Messages
757
Country
netherlands
Good evening gentlemen!

I have offered myself to finish one certain xml gauge, should have been an easy altimeter. But thing has got a little much cofusing to me as I expected it to be.

Therefore I ask you, if you know the way how to change L or G variable, either visible(via click) or invisible(namely automaticaly upon change of another fsim variable - I want to change indicated altitude into hundreds of feet as nearest integer

so for example, 2956 feet should be value of 30 (29.56 nrst is 30) displayed further on gauge as 3000 feet, while 731 would return 7 shown as 700.

Hope you could help a noob! :rolleyes:
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
Hi,

This conversion should work:

((L)(A)Var,feet) 100 / near ie 2956 -> 29.56 -> 30

Is this what you were looking for?

Tom
 
Messages
757
Country
netherlands
Well, I actally know the code of conversion itself, but the thig is, i dont know HOW to use it. Should I use tag Script? Tag Macro? Where do I define in which variable would that coverted value stored? In parameter? What is its syntax?


Well, for exaple of what am I looking for would be:

For invisible put this right after gauge definition

Code:
<macro var="L:your name here">(A:INDICATED ALTITUDE,feet) 100 / near</macro>

See what I mean?

Thanks for your effort anyway.
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
You can put it directly in a <string> tag, or use a macro if the expression is needed more than once in the code

For example (FS9 schema)

<Text .....>
<String>%((A:INDICATED ALTITUDE,feet) 100 / near)%!d!</String>
</Text>

or

<Macro Name="MyMacro">(A:INDICATED ALTITUDE,feet) 100 / near</Macro>

<Text .....>
<String>%(@MyMacro)%!d!</String>
</Text>

etc.

Tom
 
Messages
757
Country
netherlands
Thanks, that was EXACTLY what I wanted to hear :)

I thank you in the name of all virtual Czech Air Force Hind pilots :D
 
Messages
757
Country
netherlands
Back I am again :(

Gauge resists to load, it just doesnt shoe up in FS. Added well to panel.cfg for sure.

Could it be cause by using reference to macro as vaule not string (direct use in calculating value for "case" - I wanted to isolate certain number (ones, tens, hudreds) and write them thorugh case like case of 1 show 1.bmp and so)?

If yes, how could I avoid it other than using syntax for calculating every single time? I dont want the code to be very complicated if I wanted to revise it later.

Thanks
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
It would be of great help if you post an example of the code you are working on, with an explanation in plain english of what you really want to do.

Tom
 
Messages
757
Country
netherlands
Good idea indeed! I hope I wont let anything important out!

Code:
<Macro Name="Hfeet">(A:INDICATED ALTITUDE,feet) 100 / near</Macro>

This would return the value I need

Code:
<Element>
		<Visible>(A:Circuit general panel on, bool)</Visible>
		<Position X="106" Y="48"/>
		<Select>


		<Value>(@Hfeet) 10 / (@Hfeet) 100 / flr 10 *  - flr ;</Value>
		<Case Value="0"><Image Name="0.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="1"><Image Name="1.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="2"><Image Name="2.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="3"><Image Name="3.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="4"><Image Name="4.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="5"><Image Name="5.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="6"><Image Name="6.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="7"><Image Name="7.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="8"><Image Name="8.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="9"><Image Name="9.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		</Select>
	</Element>

This should check second number in Hfeet value - tens in nubers, thousands of feet, and set BMP of digit according to it.

Picture of real gauge so you have an idea of what I am trying to write

dsc06640.jpg
 
Last edited:

taguilo

Resource contributor
Messages
1,585
Country
argentina
You must use @Hfeet instead of (@Hfeet)
And remove the ; so the code would be:

<Value>@Hfeet 10 / @Hfeet 100 / flr 10 * - flr</Value>

Tom
 
Messages
757
Country
netherlands
It still wont show up. I am lost now :( :( :( :( :(

Code:
<Gauge Name="Mi-24_feetmeter" Version="1.6" Copyright="2006 Peter PRISKIN and 2007 Peter FABIAN">
<Image Name="bg.bmp" ImageSizes="320,186" Luminous="1"/>


<!-- calculations -->

<Macro Name="Hfeet">(A:INDICATED ALTITUDE,feet) 100 / near</Macro>

<!-- Hfeet -->

<!-- Feetometer -->

	<Element>

		<Visible>(A:Circuit general panel on, bool)</Visible>
		<Position X="68" Y="48"/>
		<Select>
                
		<Value>@Hfeet 100 / flr </Value>
		<Case Value="0"><Image Name="0.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="1"><Image Name="1.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="2"><Image Name="2.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="3"><Image Name="3.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="4"><Image Name="4.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="5"><Image Name="5.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="6"><Image Name="6.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="7"><Image Name="7.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="8"><Image Name="8.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="9"><Image Name="9.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		</Select>
	</Element>
	
	
	<Element>
		<Visible>(A:Circuit general panel on, bool)</Visible>
		<Position X="106" Y="48"/>
		<Select>


		<Value>@Hfeet 10 / @Hfeet 100 / flr 10 *  - flr </Value>
		<Case Value="0"><Image Name="0.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="1"><Image Name="1.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="2"><Image Name="2.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="3"><Image Name="3.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="4"><Image Name="4.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="5"><Image Name="5.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="6"><Image Name="6.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="7"><Image Name="7.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="8"><Image Name="8.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="9"><Image Name="9.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		</Select>
	</Element>

	<Element>
		<Visible>(A:Circuit general panel on, bool)</Visible>
		<Position X="144" Y="48"/>
		<Select>


		<Value>@Hfeet @Hfeet 10 / flr 10 *  - flr</Value>
		<Case Value="0"><Image Name="0.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="1"><Image Name="1.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="2"><Image Name="2.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="3"><Image Name="3.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="4"><Image Name="4.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="5"><Image Name="5.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="6"><Image Name="6.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="7"><Image Name="7.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="8"><Image Name="8.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		<Case Value="9"><Image Name="9.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
		</Select>
	</Element>
	
	
	<Element>
		<Visible>(A:Circuit general panel on, bool)</Visible>
		<Position X="182" Y="48"/>
		<Image Name="0.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/></Case>
	</Element>
	
	
	<Element>
		<Visible>(A:Circuit general panel on, bool)</Visible>
		<Position X="220" Y="48"/>
	  <Image Name="0.bmp" Luminous="Yes" Bright="Yes" ImageSizes="36,49"/>
	</Element>
	
	
   <Mouse>
      <Tooltip>%ALTITUDE (feet)</Tooltip>
   </Mouse>



</Gauge>
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
If what you mean is the gauge isn't showing, then there must be a syntax error. To check this, load the xml file into Internet Explorer, and the error(s) will show up there.

Tom
 
Top