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

FSXA A: variable

... and on more. I wrote the visibility code below for charge annuciator lamp, but the state of the L:kapcsolo_akku dosn't make any affect on the light. Maybe I should put one more if/els statement in the code?

Code:
<PartInfo>
  <Name>toltes_jelzo</Name>
   <Visibility>
   <Parameter>
   <Code>
    (L:kapcsolo_akku, bool) 1 ==     
    (A:GENERAL ENG MASTER ALTERNATOR:1, bool) 0 == AND
    (A:GENERAL ENG RPM:1, rpm) (A:Electrical GenAlt Bus Voltage:1, volts) / 35.7 &lt; AND
     if{ 1 } els{ 0 }
    </Code>
   </Parameter>
   </Visibility>
</PartInfo>
 
AND will never work! You must use lowercase for this conjunction:
and or && or &amp;&amp;
 
Hello! New day, new task :) I've made a code - but this time it works :D This code controls the anim of the attitude indicator's sphere. The a.i. needs 3 switches to turn on for operate : main switch, battery and inverter. When it is uncaged and the switches are off, the sphere banks to the right slowly. The a.i. is "cage-able" in every situtation. There's one thing that should be better : when I switch on the L: variables, the sphere jumps to it's position, not "floating". What would be the solution for this?



Code:
 <PartInfo>
    <Name>needle_attitude_bank</Name>
    <AnimLength>360</AnimLength>
    <Animation>
      <Parameter>
        <Code>  
          (A:ATTITUDE CAGE,bool) 0 ==
          (L:kapcsolo_valto,bool) 1 == and   
          (L:kapcsolo_akku, bool) 1 == and 
          (A:ELECTRICAL MASTER BATTERY,bool) 1 == and
          if{ (A:ATTITUDE INDICATOR BANK DEGREES, degrees) dnor (>L:bank, degrees) }
         els{ (A:ATTITUDE CAGE,bool) 1 == 
          if{ 0 (>L:bank,degrees) } 
         els{ (L:bank, degrees) 0.05 + (>L:bank, degrees) } }
            (L:bank, degrees)
         </Code> 
       </Parameter>
    </Animation>
  </PartInfo>
 
Try adding a <Lag> just after the </Code> entry:

Code:
     </Code>
     <Lag>200</Lag>

Smaller number is faster response.
 
Yes I tried it, but with <Lag> after one revoution the sphere starts to rotate in the opposite direction...
 
I sort of thought that might happen...

I see that you are using a 'counter' to slowly bring the ball to it's caged position.

You need to use a similar 'counter' to slowly bring the ball back to it's active position.
 
Ok, I will try to make the code, but I have the next question. The code below gives the value '1' to the master battery switch or it toggles the switch only ?

Code:
 1 (>K:TOGGLE_MASTER_BATTERY)

If the second answer is the true then the next code NOT toggles the battery switch?

Code:
 0 (>K:TOGGLE_MASTER_BATTERY)
 
"1" toggles master battery on,
"0" toggles it off.

This is a method of setting exact values, in that case boolean 0 = off, respectively boolean 1 = on for this particular variable.

If you'd for instance use
Code:
16383 (>K:ELEVATOR_TRIM_SET)
this would set your trimming into the full up position (range 0 - 16383 according to the SDK)
 
I don't believe that this is my experience - for me, any number placed into a TOGGLE EventID just changes the state from what it is to the other state. The value doesn't get read at all. Do you have a gauge that actually uses the value placed into this TOGGLE successfully?

I agree that it works fine with SET EventID's.
 
Thanks Mathias! And what about other variables? Is this the rule for all the event IDs?

I made this code. I want the attitude indicator caged at startup. With this cage the cage knob works inversely, ie. pushed in - caged, pulled out - uncaged :(

Code:
<PartInfo>
  <Name>knob_cage_attitude</Name>
  <AnimLength>20</AnimLength>
  <Animation>
  <Parameter>
  <Code>
    (L:cage, bool) 0 ==
    (A:ATTITUDE CAGE, bool) 0 == and
    if{ 1 (>K:ATTITUDE_CAGE_BUTTON) 1 (>L:cage,bool) }
    (L:cage_button,bool) 20 * 
  </Code>
  </Parameter>
  <Lag>200</Lag>
  </Animation>
  <MouseRect>
  <TooltipID>TOOLTIPTEXT_ATTITUDE_GYRO_CAGE</TooltipID>
  <Cursor>Hand</Cursor>
  <CallbackCode>
   (L:cage_button,bool) ! (>L:cage_button,bool)

   (L:cage_button,bool) 0 == if{ 0 (>K:ATTITUDE_CAGE_BUTTON) }
   (L:cage_button,bool) 1 == if{ 1 (>K:ATTITUDE_CAGE_BUTTON) }
                                   
  </CallbackCode>
  </MouseRect>
</PartInfo>
 
Although "toggle" isn't included in the key event ATTITUDE_CAGE_BUTTON, it is nonetheless a "toggle." Check the name used for the C gauge equivalent to this key event: KEY_TOGGLE_ATTITUDE_CAGE

You can put any number you want in front of it and it will make no difference whatsoever.

The way toggle type events work is:

  1. if on, turn it off
  2. if off, turn it on
 
But in the modeldef.xml the default cage button uses the "(&gt;K:ATTITUDE_CAGE_BUTTON) " fomula and it toggles, or am I wrong?

Anyway I found out THE code, just throw away the L:cage_button variable, and put ATTITUDE CAGE instead. How simple it is.... :D

Code:
<PartInfo>
  <Name>knob_cage_attitude</Name>
  <AnimLength>20</AnimLength>
  <Animation>
  <Parameter>
  <Code>
    (L:cage, bool) 0 ==
    (A:ATTITUDE CAGE, bool) 0 == and
    if{ (>K:ATTITUDE_CAGE_BUTTON) 1 (>L:cage,bool) }
    (A:ATTITUDE CAGE,bool) 20 * 
  </Code>
  </Parameter>
  <Lag>200</Lag>
  </Animation>
  <MouseRect>
  <TooltipID>TOOLTIPTEXT_ATTITUDE_GYRO_CAGE</TooltipID>
  <Cursor>Hand</Cursor>
  <CallbackCode>
      (&gt;K:ATTITUDE_CAGE_BUTTON) 
  </CallbackCode>
  </MouseRect>
</PartInfo>
 
But in the modeldef.xml the default cage button uses the "(&gt;K:ATTITUDE_CAGE_BUTTON) " fomula and it toggles, or am I wrong?

Anyway I found out THE code, just throw away the L:cage_button variable, and put ATTITUDE CAGE instead. How simple it is.... :D

Of course it does. That is not what I was saying!

You have been putting a number in front of the command event:

0 (&gt;K:ATTITUDE_CAGE_BUTTON)

That number is completely unnecessary for this type of "toggle command." That is all I was referring to... ;)

And yes, the solution is quite simple and obvious... :D
 
Back
Top