• 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 The stack in xml-gauges

Messages
2
Country
sweden
Well, the documentation about the stack in xml gauges is not the best i encunterd...
Could someone give me a example or two how to assign values to the stack?

Can´t find any good examples or tutorials elsewere either. Any tips?
 
Hehe, that's strange - I was just about to start a new thread about the same problem when your thread popped up!!! :D

Anyhow, yours first:
I assume you already checked the SDK?
Maybe you find these threads as interesting to read as I did:

http://www.fsdeveloper.com/forum/showthread.php?p=181477#post181477
(scroll down to post 8 following)

http://www.fsdeveloper.com/forum/showthread.php?p=69372#post69372
(also scroll down to post 8 following)

http://www.fsdeveloper.com/forum/showthread.php?p=137276#post137276
(you guess it: scroll down to post 8 following :D )

Using the stack can be pretty helpful and time saving I realized today :)


-----------------------

My short question:

This is a part of my helicopter autopilot gauge (the part that controls collective for altitude hold).
My problem is that the value of l11 never gets bigger than 80. To my mind s11 stores the correct value, but l11 then always loads "0".

Code:
(A:Vertical SPEED,feet per minute) (L:AP_VS_Var,number) - s12 abs 0 >
      if{ [COLOR="red"]l11[/COLOR] 2 l12 abs 50 / 40 min * l12 l12 abs / * - 14500 min [COLOR="Red"]sp11[/COLOR] }

l11 (>K:THROTTLE_SET)

I already replaced the s11 and l11 by a L:var and it worked fine. But why doesn't this way work??


Cheers,
Steven
 
Last edited:
My short question:

This is a part of my helicopter autopilot gauge (the part that controls collective for altitude hold).
My problem is that the value of l11 never gets bigger than 80. To my mind s11 stores the correct value, but l11 then always loads "0".

Code:
(A:Vertical SPEED,feet per minute) (L:AP_VS_Var,number) - s12 abs 0 >
      if{ [COLOR="red"]l11[/COLOR] 2 l12 abs 50 / 40 min * l12 l12 abs / * - 14500 min [COLOR="Red"]sp11[/COLOR] }

l11 (>K:THROTTLE_SET)

I already replaced the s11 and l11 by a L:var and it worked fine. But why doesn't this way work??

Your formula seems rather difficult to figure out. Bear in mind that in:


if{ l11 2 l12 abs 50 / 40 min * l12 l12 abs / * - 14500 min sp11 }

the whole part in red is processed first, leaving this:

if{ l11 red_result - 14500 min sp11 }

There is no s11 previous to l11, so at gauge load, l11 will be 0.

Also remember that registers (s/l) don't port their values to other gauges, they are local to the current one, as opposite to Lvars. And, because the stack is cleared on every cycle, they are reset to 0 on every cycle as well.

Tom
 
Could someone give me a example or two how to assign values to the stack?

Sure.

For example

<Update>(A:Vertical SPEED,feet per minute)</Update>

the value contained in (A:Vertical SPEED,feet per minute) is placed on the stack
If it is, for example, 800, then the stack contains 800

Here :
<Update>(A:Vertical SPEED,feet per minute) 500</Update>

The stack contains two values, the var value 800 and 500

Now:
<Update>(A:Vertical SPEED,feet per minute) 500 +</Update>

the stack contais 1300, because the operator + placed at the end automatically performs an addition, leaving the new value and removing the previous operands.

This is the basic principle.

Tom
 
Hi, Tom!

Yes, the formula is difficult, but it works well ;)

And, because the stack is cleared on every cycle, they are reset to 0 on every cycle as well.

That clears it up. So in fact I cannot use the s/l feature for that code. Then I will simply stick with a L:var.

(And I will check my remaining code with s/l usage.
What a bummer that they refresh!:()

Thanks a lot,
Steven
 
Yeah, they refresh even within the same gauge.

Stream code from <Update> and <Element> shares the stack, so values and registers are kept across.

Event code from <Mouse> and <Keys> refreshes the stack/registers, and values are retained only within a single command (ie <Area>,<On Event>, etc).

Tom
 
Tom,

your tip about the refreshing stack made me think about a code example from Wozza I found earlier:

Code:
 <Update Frequency="6"/>
<Macro Name="Loop">
1 3 5 6 7 10 11 12 14 9 l0 case ( A:SURFACE TYPE,number) ==  if{ 1 sp1 }
</Macro>
<Element>
<Select>
<Value>
 c
 :0 @Loop l0 ++ s0 10 &lt; if{ g0 }
 l1
(A:ENG1 COMBUSTION,number) 0 &gt;
(A:RADIO HEIGHT,meters) 2 &lt;
&amp;&amp; &amp;&amp; if{ (A:SMOKE ENABLE,bool) ! if{ (>K:SMOKE_ON) } } els{ (A:SMO
</Select>
</Element>

Again the l0 is before the s0, but this time in a goto loop.
Does this mean that the current gauge cycle is prevented from completing and thus the stack isn't refreshed?

Steven
 
In that example the loop is executed within the same gauge cycle.
Within the <Value> command, the stack is first cleared with the c operator, and the registers are all reset to 0. Therefore, in the loop's first pass, l0 equals 0, and starts increasing after the l0 ++ s0 sentence. And the loop will execute while l0 equivalent value is lower than 10 (actually should be 9 &lt; as case's first evaluator is 0).

Tom
 
Last edited:
Hello,

Sorry to not create a new thread, but I think that is not necessary. I searched on the forum and didn't find information

I am not sure to understand the real difference between s0 and sp0.

So, if somebody can help me to know the difference ?

thanks

François
 
Maybe this will help -
Code:
CODE              RESULTING STACK     #9 REGISTER (l9)
14 25 s9 36       14 25 36            25
14 25 sp9 36      14 36               25
 
Last edited:
THanks. I must read this peacefully :banghead:

I thought that when I store something in register 1 ( Mynumber sp1), the value remained in the register 1 until I set a new number by sp1. I thought that s(n) was like a user variable, but it seems to move permanently.

So, to help me with a simple concrete example, in what case we must use sp0 and not s0 ?


Edit :
:idea:
sp is to store something, and value not move of stack level with next stack operation. Right ?

So in this case, there is more security to use always "sp" ? isn't it ?
 
If you use s... you're saying store the value in the register and keep the value on the stack. If you use sp... you're saying store the value in the register and remove it from the stack.
 
I assume that the p stands for Pop, which is a common way to say "remove from the stack".
 
Tom,

your tip about the refreshing stack made me think about a code example from Wozza I found earlier:

Code:
 <Update Frequency="6"/>
<Macro Name="Loop">
1 3 5 6 7 10 11 12 14 9 l0 case ( A:SURFACE TYPE,number) ==  if{ 1 sp1 }
</Macro>
<Element>
<Select>
<Value>
c
:0 @Loop l0 ++ s0 10 &lt; if{ g0 }
l1
(A:ENG1 COMBUSTION,number) 0 &gt;
(A:RADIO HEIGHT,meters) 2 &lt;
&amp;&amp; &amp;&amp; if{ (A:SMOKE ENABLE,bool) ! if{ (>K:SMOKE_ON) } } els{ (A:SMO
</Select>
</Element>

Again the l0 is before the s0, but this time in a goto loop.
Does this mean that the current gauge cycle is prevented from completing and thus the stack isn't refreshed?

Steven
LOL actually truth be told it was Tom who came up with the main core of the above code ;)
 
Didn't someone do an excel spreadsheet once that could do the xml calculations and display the stack? Or is my memory going?
A quick search for fsx xml excel doesn't bring up anything interesting. ... if only I wasn't so busy...
 
Didn't someone do an excel spreadsheet once that could do the xml calculations and display the stack? Or is my memory going?
A quick search for fsx xml excel doesn't bring up anything interesting. ... if only I wasn't so busy...

You're looking for this?
 
Back
Top