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

Counting up (easy) - then down (not so easy)

Messages
853
Country
indonesia
I'm doing (trying to anyway) an old radar with a horizontal sweep.
I'm trying to generate a sequence of numbers, 0,8,16,24 ... 496,504. Then I want to count down to zero again.

This get me up and the sweep looks good (512x512 background bmp with an 8x512 sweep line)
<Value>(E:ABSOLUTE TIME,seconds) 32 * 63 %</Value>
but then resets to zero...

Anyone any ideas how to do this in a cyclic manner?
 
I did this by adding another variable that holds the direction information. Also I would use a simple increment approach to it. Not sure if you can use <Value> to actually calculate a big chunk of code, I prefer <Code>.

Code:
<Parameter>
        <Code>
          (L:SWEEP LEFT,bool) 0 ==
          if{
            (L:RADAR POSITION,number) 1 + d (&gt;L:RADAR POSITION,number)
            63 &gt;
            if{
              1 (&gt;L:SWEEP RIGHT,bool)
            }
          }
          els{
            (L:RADAR POSITION,number) 1 - d (&gt;L:RADAR POSITION,number)
            1 &lt;
            if{
              0 (&gt;L:SWEEP RIGHT,bool)
            }
          }
          (L:RADAR POSITION,number)
        </Code>
      </Parameter>
</Value>

Not tested, but at least it should give you an idea.

Cheers,
Vitus
 
I am suitably impressed :)
I couldn't get my head around the <Parameter> <Code> thing (probably because I've only started with eXtremely Masochistic Language a week or so ago) but I managed to fit it in like this:

<Gauge Name="EE Radar v0.1">
<Image Name="EE_radar_background.bmp"/>

<Element>
<Position X="0" Y="0"/>
<Image Name="EE_radar_scan.bmp"/>
<Shift>
<Value>(L:SWEEP LEFT,bool) 0 == if{
(L:RADAR POSITION,number) 2 + d (&gt;L:RADAR POSITION,number) 63 &gt; if{ 1 (&gt;L:SWEEP LEFT,bool) }
}
els{
(L:RADAR POSITION,number) 2 - d (&gt;L:RADAR POSITION,number) 1 &lt; if{ 0 (&gt;L:SWEEP LEFT,bool) }
} (L:RADAR POSITION,number)</Value>
<Nonlinearity>
<Item Value="0" X="0" Y="0"/>
<Item Value="63" X="504" Y="0"/>
</Nonlinearity>
</Shift>
</Element>

</Gauge>

Sorry about re-arranging your code layout - I just like to see where braces line up :)
Thanks for taking the time to help me.

Chris.

Edit: So much for for code layout - one day I'll have to find out how to put code in that box like you did...
 
Last edited:
Edit: So much for for code layout - one day I'll have to find out how to put code in that box like you did...

Well, that's the easy part!
In the top toolbar of your message screen, you can click on the # mark and insert your code between the two new CODE words that just appeared.

It is recommended to use this because it will prevent your message looking like a smiley contest because some code fragments are interpreted as smileys by the forum software.

grt
Willem
 
There, nicely reformatted and in a
Code:
 box!

[CODE]
<Gauge Name="EE Radar v0.1">
  <Image Name="EE_radar_background.bmp"/>
  <Element>
    <Position X="0" Y="0"/>
    <Image Name="EE_radar_scan.bmp"/>
    <Shift>
      <Value>
        (L:SWEEP LEFT,bool) 0 == if{
        (L:RADAR POSITION,number) 2 + d (&gt;L:RADAR POSITION,number) 63 &gt; if{ 1 (&gt;L:SWEEP LEFT,bool) }
        }
        els{
        (L:RADAR POSITION,number) 2 - d (&gt;L:RADAR POSITION,number) 1 &lt; if{ 0 (&gt;L:SWEEP LEFT,bool) }
        } (L:RADAR POSITION,number)
      </Value>
      <Nonlinearity>
        <Item Value="0" X="0" Y="0"/>
        <Item Value="63" X="504" Y="0"/>
      </Nonlinearity>
    </Shift>
  </Element>
</Gauge>
 
Hey Chris,

sorry, I didn't realize that you were talking about a 2D gauge - I thought you were looking for an animation code snippet :o
But it looks like you figured it out yourself how to change it, so good on you!

To insert a code section in the forums use the #-button in the editor.

Cheers,
Vitus
 
Back
Top