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

Why won't this rotate?

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Can anyone suggest why this script doesn't seem to work? It's not too complicated! It should simply increment the L:var from 0 to 36 then reset, rinse and repeat endlessly:
Code:
  <!-- CUSTOM SCRIPTS -->
  <Animation name="Beacon_Light_Rotate" guid="f7e61f65-6d05-480d-b9f9-6c04e0c0484c" length="36" type="Sim" typeParam2="Beacon_Light_Rotate" typeParam="AutoPlay" />

  <PartInfo>
    <Name>Beacon_Light_Rotate</Name>
    <AnimLength>36</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (A:LIGHT BEACON,bool)
          if{ (L:Beacon_Light_Rotate,enum) ++ 37 % (>L:Beacon_Light_Rotate,enum) }
        </Code>
      </Parameter>
    </Animation>
  </PartInfo>
 
Messages
407
Country
ca-britishcolumbia
I tested the code, which works (counts up to 36 and repeats), so the answer is not in the code.
 
Messages
230
Country
ecuador
Hi Bill,
Personally, I will simply add a line to the code to know exactly which variable to use for the animation...! Apprentice notice....

Code:
<Code>
    (A:LIGHT BEACON,bool)
    if{ (L:Beacon_Light_Rotate,enum) ++ 37 % (>L:Beacon_Light_Rotate,enum) }
    (L:Beacon_Light_Rotate,enum)
</Code>
 
Last edited:
D

Deleted member 1281

Guest
Some "apprentice notice"! With it does work, without it it doesn't. Now someone riddle me that!

Edit: this also works (putting a copy of the value on the stack) ...

Code:
<Code>
        (A:LIGHT BEACON,bool)
        if{ (L:Beacon_Light_Rotate,enum) ++ 37 % d (>L:Beacon_Light_Rotate,enum) }
</Code>
 
Last edited by a moderator:

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Thanks for the kick in the butt guys. I should have caught that myself, but my only excuses are (a) old age and failing memory and (b) that I don't script all that much any longer having long ago gotten 90%+ that I need already done and tested. Rarely do I have to do something "new."

Of course "duplicating" the result of the iteration using "d" to put the result on the stack is absolutely necessary, otherwise the result isn't "remembered" for the next iteration! :wave:
 
Messages
230
Country
ecuador
Of course "duplicating" the result of the iteration using "d" to put the result on the stack is absolutely necessary, otherwise the result isn't "remembered" for the next iteration!
This method is much more elegant than mine...! We learn a little more every day...! :D
 
Messages
407
Country
ca-britishcolumbia
I am left a little confused by this thread. I copied and pasted the original code into a gauge and watched the value of the variable count up to 36 repeatedly as intended. So the code works in a gauge, but not when compiled into the model?
 
Messages
230
Country
ecuador
It also works very well in the .mdl : the value of (L:Beacon_Light_Rotate,enum) is well implemented, but the animation does not know which value to use to make the animation work. For this reason, it is necessary to "remind" the animation that it is the variable (L:Beacon_Light_Rotate,enum) that it should be used, and it is necessary to put it on the stack!
 
Top