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

FS2004 Bell 429 Starter idea... pfew! (SOLVED)

Messages
1,451
Country
mexico
Hello lads

Recently, I made a comment on the showroom and Heretic came with and idea. I know this have been said before but I will do it anyway. I have this code working for a 3 way starter switch; it is working as it should and I am trying to make it work as an animated part in the VC. Both engines are simulated as "Engine 2" and "Engine 3". Engine 1 is used to work with animations in both rotors in my Bell 429. I will start showing the code in the 2D gauge:
HTML:
      <!--  Starter Behavior -->
        <Element>
              <Select>
                    <Value>
                        (A:Turb eng2 N1, percent) 55 &gt;
                                if{ 0 (&gt;L:Eng2StarterSwitch, bool) }

                        (A:Turb eng3 N1, percent) 55 &gt;
                                if{ 0 (&gt;L:Eng3StarterSwitch, bool) }

                        (L:Eng2StarterSwitch, bool) 1 ==
                                if{ (L:Eng3Running,bool)
                                      if{ (A:General Eng3 Master Alternator, bool) 1 == (A:Turb eng3 N1, percent) 60 &gt; &amp;&amp;
                                            if{ (&gt;K:TOGGLE_STARTER2) }
                                        }
                                 els{ (A:Electrical Master Battery,bool)
                                      if{ (&gt;K:TOGGLE_STARTER2) }
                                       }
                                  }

                        (L:Eng3StarterSwitch, bool) 1 ==
                                if{ (L:Eng2Running,bool)
                                      if{ (A:General Eng2 Master Alternator, bool) 1 == (A:Turb eng2 N1, percent) 60 &gt; &amp;&amp;
                                            if{ (&gt;K:TOGGLE_STARTER3) }
                                  }
                                 els{ (A:Electrical Master Battery,bool)
                                      if{ (&gt;K:TOGGLE_STARTER3) }
                                       }
                                  }
                    </Value>
              </Select>
        </Element>

Now, I have set 3 different mouse areas. From left to right: Starter 2 acting, Center is the neutral position for both starters and the right position is for starter 3.
Mouse_areas.jpg


HTML:
<!--                                                                                                       M O U S E   E V E N T    L O G I C                                                                                                            -->
        <!-- Starter Switches -->
          <Area Left="490" Top="30" Width="35" Height="35">
                <Cursor Type="Hand"/>
                <Click Repeat="Yes" MouseWheelFlip="No">
                      1 (&gt;L:Eng2StarterSwitch, bool)
                </Click>
          </Area>
             
          <Area Left="527" Top="30" Width="35" Height="35">
                <Cursor Type="Hand"/>
                <Click Repeat="Yes" MouseWheelFlip="No">
                    0 (&gt;L:Eng2StarterSwitch, bool)
                    0 (&gt;L:Eng3StarterSwitch, bool)
                </Click>
          </Area>
             
          <Area Left="564" Top="30" Width="35" Height="35">
              <Cursor Type="Hand"/>
              <Click Repeat="Yes" MouseWheelFlip="No">
                  1 (&gt;L:Eng3StarterSwitch, bool)
              </Click>
          </Area>

Heretic suggested I use a control to animate the switch. He used a different variable, however the code is the same:
HTML:
<!-- This is a Mouse area for the 2D panel -->
<Area Left="139" Top="340" Width="42" Height="52">
      <Tooltip>Starter (Position: %((L:429_Starter_switch_control, number))%!1.0f!)</Tooltip>
      <Cursor Type="Hand"/>
      <Click Kind="LeftSingle+RightSingle" Repeat="Yes">
            (M:Event) 'LeftSingle' scmp 0 ==
                if{ (L:429_Starter_switch_control, number) ++ 2 min (&gt;L:429_Starter_switch_control, number) }
               
            (M:Event) 'RightSingle' scmp 0 ==
                if{ (L:429_Starter_switch_control, number) -- 0 max (&gt;L:429_Starter_switch_control, number) }
      </Click>
</Area>

And now, the "funny" part for me. This is my attempt using the control in order to have a direct interaction between the controller in the 3D object and the 2D gauge. I don't know what I am doing (LOL), but there you go:
HTML:
      <!--  Starter Behavior -->
        <Element>
              <Select>
                    <Value>
                        (A:Turb eng2 N1, percent) 55 &gt;
                                if{ 0 (&gt;L:Eng2StarterSwitch, bool) }

                        (A:Turb eng3 N1, percent) 55 &gt;
                                if{ 0 (&gt;L:Eng3StarterSwitch, bool) }

                        (L:Eng2StarterSwitch, bool) 1 == (L:429_Starter_switch_control, number) 1 == &amp;&amp;
                                if{ (L:Eng3Running,bool)
                                      if{ (A:General Eng3 Master Alternator, bool) 1 == (A:Turb eng3 N1, percent) 60 &gt; &amp;&amp;
                                            if{ (&gt;K:TOGGLE_STARTER2) }
                                        }
                                 els{ (A:Electrical Master Battery,bool)
                                      if{ (&gt;K:TOGGLE_STARTER2) }
                                       }
                                  }

                        (L:Eng3StarterSwitch, bool) 1 == (L:429_Starter_switch_control, number) 2 == &amp;&amp;
                                if{ (L:Eng2Running,bool)
                                      if{ (A:General Eng2 Master Alternator, bool) 1 == (A:Turb eng2 N1, percent) 60 &gt; &amp;&amp;
                                            if{ (&gt;K:TOGGLE_STARTER3) }
                                  }
                                 els{ (A:Electrical Master Battery,bool)
                                      if{ (&gt;K:TOGGLE_STARTER3) }
                                       }
                                  }
                    </Value>
              </Select>
        </Element>

Now the "new mouse areas" with the controller:
HTML:
      <Mouse>
              <!-- Starter Switches with three click areas-->
          <Area Left="490" Top="30" Width="35" Height="35">
                <Cursor Type="Hand"/>
                <Click Repeat="Yes" MouseWheelFlip="No">
                      1 (&gt;L:Eng2StarterSwitch, bool)
                      (L:429_Starter_switch_control, number) ++ 2 % (L:429_Starter_switch_control, number)
                </Click>
          </Area>
             
          <Area Left="527" Top="30" Width="35" Height="35">
                <Cursor Type="Hand"/>
                <Click Repeat="Yes" MouseWheelFlip="No">
                    0 (&gt;L:Eng2StarterSwitch, bool)
                    0 (&gt;L:Eng3StarterSwitch, bool)
                    (L:429_Starter_switch_control, number) ++ 2 % (L:429_Starter_switch_control, number)
                </Click>
          </Area>
             
          <Area Left="564" Top="30" Width="35" Height="35">
              <Cursor Type="Hand"/>
              <Click Repeat="Yes" MouseWheelFlip="No">
                  1 (&gt;L:Eng3StarterSwitch, bool)
                  (L:429_Starter_switch_control, number) ++ 2 % (L:429_Starter_switch_control, number)
              </Click>
          </Area>
      </Mouse>

If I understood well, the part code (FS9) should be something like this:
HTML:
<!-- This is an attempt to implement the same Mouse area embeded in the correspondig 3D object (FS9) -->
<part>
    <name>bell429_starter_switch</name>
        <animation>
        <parameter>
        <code>1 (L:429_Starter_switch_control) - 25 *</code>
        <lag>100</lag>
        </parameter>
        </animation>
        <mouserect>
            <cursor>Hand</cursor>
            <Tooltip>Starter (Position: %((L:429_Starter_switch_control, number))%!1.0f!)</Tooltip>
            <mouse_flags>LeftSingle+RightSingle</mouse_flags>
            <callback_code>
                  (M:Event) 'LeftSingle' scmp 0 ==
                      if{ (L:429_Starter_switch_control, number) ++ 2 min (&gt;L:429_Starter_switch_control, number) }
                     
                  (M:Event) 'RightSingle' scmp 0 ==
                      if{ (L:429_Starter_switch_control, number) -- 0 max (&gt;L:429_Starter_switch_control, number) }
            </callback_code>
        </mouserect>
</part>

I am starting to grasp the idea; however a funny sensation is just behind me: I'm complicating everything and just don't know what's wrong. Any ideas certainly will be very welcome.

All the best,
Sergio.
 

Heretic

Resource contributor
Messages
6,830
Country
germany
As long as the 3D and 2D elements communicate through the same variable(s), their movements and actions will be synched.
 
Messages
1,451
Country
mexico
Hi Björn

Thank you; will test this as soon as I can. I assume that I am in the right path then.
 

euroastar350

Resource contributor
Messages
826
Country
us-delaware
1 (&gt;L:Eng3StarterSwitch, bool) (L:429_Starter_switch_control, number) ++ 2 % (L:429_Starter_switch_control, number)


Your Lvars have different names to them. So therefore, the VC switches won't communicate with what's in the XML gauge, although they will be animated with no function in the VC.
 
Messages
1,451
Country
mexico
Thanks bro, however that's when I get lost. The original Jordan's code includes that variable and I am trying to fit it Björn's controller.

My idea is to enable both sequences using the same spots in the 2D gauge; the part I just don't get right is the VC.

I was thinking if I use an "AND" operatior, both variables could mixed in a more logical way. Don't get me wrong, I don't know what I am doing... :confused::confused::confused:

If you see more close this part of code, it has the original variables and also the controller in that click spot performing the loop increasing controller varible as well. That's the point, my XML knowledge is constrain me.

HTML:
<Click Repeat="Yes" MouseWheelFlip="No">
                    0 (&gt;L:Eng2StarterSwitch, bool)
                    0 (&gt;L:Eng3StarterSwitch, bool)
                    (L:429_Starter_switch_control, number) ++ 2 % (L:429_Starter_switch_control, number)
                </Click>
 
Last edited:

Heretic

Resource contributor
Messages
6,830
Country
germany
I took a closer look at your original code and its indeed much more complicated than need be.

Logic control:
Code:
<!-- Starter Behavior -->
<Element>
<Select>
<Value>
(A:Turb eng2 N1, percent) 55 &gt;
(A:Turb eng3 N1, percent) 55 &gt; or
if{ 0 (&gt;L:429_Starter_switch_control, number) }

(L:429_Starter_switch_control, number) 1 ==
if{ (L:Eng3Running,bool) if{ (A:General Eng3 Master Alternator, bool) 1 == (A:Turb eng3 N1, percent) 60 &gt; &amp;&amp; if{ (&gt;K:TOGGLE_STARTER2) } }
els{ (A:Electrical Master Battery,bool) if{ (&gt;K:TOGGLE_STARTER2) } } }

(L:429_Starter_switch_control, number) 2 ==
if{ (L:Eng2Running,bool) if{ (A:General Eng2 Master Alternator, bool) 1 == (A:Turb eng2 N1, percent) 60 &gt; &amp;&amp; if{ (&gt;K:TOGGLE_STARTER3) } }
els{ (A:Electrical Master Battery,bool) if{ (&gt;K:TOGGLE_STARTER3) } } }
</Value>
</Select>
</Element>

2D switch, if you want to keep the original clickspots:
Code:
<!-- Starter Switches -->
<Area Left="490" Top="30" Width="35" Height="35">
<Cursor Type="Hand"/>
<Click Repeat="Yes" MouseWheelFlip="No">
1 (&gt;L:429_Starter_switch_control, number)
</Click>
</Area>

<Area Left="527" Top="30" Width="35" Height="35">
<Cursor Type="Hand"/>
<Click Repeat="Yes" MouseWheelFlip="No">
0 (&gt;L:429_Starter_switch_control, number)
</Click>
</Area>

<Area Left="564" Top="30" Width="35" Height="35">
<Cursor Type="Hand"/>
<Click Repeat="Yes" MouseWheelFlip="No">
2 (&gt;L:429_Starter_switch_control, number)
</Click>
</Area>

2D, using the same method as the 3D switch:
Code:
<Area Left="490" Top="30" Width="105" Height="35">
<Cursor Type="Hand"/>
<Click Kind="LeftSingle+RightSingle" Repeat="Yes">
(M:Event) 'LeftSingle' scmp 0 ==
if{ (L:429_Starter_switch_control, number) ++ 2 min (&gt;L:429_Starter_switch_control, number) }

(M:Event) 'RightSingle' scmp 0 ==
if{ (L:429_Starter_switch_control, number) -- 0 max (&gt;L:429_Starter_switch_control, number) }
</Click>
</Area>


3D switch:
Code:
<part>
<name>bell429_starter_switch</name>
<animation>
<parameter>
<code>1 (L:429_Starter_switch_control) - 25 *</code>
<lag>100</lag>
</parameter>
</animation>
<mouserect>
<cursor>Hand</cursor>
<Tooltip>Starter (Position: %((L:429_Starter_switch_control, number))%!1.0f!)</Tooltip>
<mouse_flags>LeftSingle+RightSingle</mouse_flags>
<callback_code>
(M:Event) 'LeftSingle' scmp 0 ==
if{ (L:429_Starter_switch_control, number) ++ 2 min (&gt;L:429_Starter_switch_control, number) }

(M:Event) 'RightSingle' scmp 0 ==
if{ (L:429_Starter_switch_control, number) -- 0 max (&gt;L:429_Starter_switch_control, number) }
</callback_code>
</mouserect>
</part>

Same variable = same language. Different mouse rectangle tags = different dialect.


I am still too tired to understand why the starter logic for engine 2 handles events for engine 3 and the other way around, but that's not within the scope of this thread.
 
Messages
1,451
Country
mexico
Hi Björn

I am still too tired to understand why the starter logic for engine 2 handles events for engine 3 and the other way around, but that's not within the scope of this thread.
Same here my friend, the code belongs to Jordan Moore and he used at least two global gauges to controll the complex starting procedure. What I have been able to decipher within the code I've shown, is only for the engine starter switch.

Good news are, that we are almost there. Lightning panel is 100% and switch panel is almost done as well. The Bell 429 is begining to look and feel right. Thank you very much for taking time to patiently read and make changes to the gauge; as I said many times, this is priceless for me. :D:D:D

All the best,
Sergio.
;)
 
Messages
1,451
Country
mexico
Close, but something is missing. I can see the 2D gauge swaping positions; nevertheless, engine "3" doesn't start. Did some experiments... but no hurrah yet.

In the 3D switch, I used:

Key 0: Engine starter 2 active (left position)
key 25: both engines neutral position (center position and engines off, running or waiting for a start condition)
Key 50: Engine starter 3 active (right position).

Using this settings, it only enables the click area; nevertheless animation doesn't work either.
It is curious to me that the 2D gauge shows the moment when engine 3 should be start to run; but as I mentioned, it doesn't. :confused::confused::confused:
 
Last edited:
Messages
10,088
Country
us-arizona
Hello Antaris,

I have a FSX model code for a starter switch for a jet. It 'might' help you, but again, its for FSX, so you'll need to convert the code to FS9 format.

This is a Learjet (early model) starter toggle. Straight out is off. Hold down is 'starter on'. You must hold it down to keep starter model going. When you mouse release the toggle, the switch springs back to off. When the turbine ignites, you release. Then you flip the switch up. It is then in Generator mode. To turn off generator, you flip the switch back to middle.
UP.....Generator on (left and right generators)
Middle....Off
Down (hold with mouse) Starter-engage, left or right engine.

Two switches; left and right.

NOTE: SNDxxxx are sound file tags for use with the Bill Leaming sound system. Its a toggle 'click' sound. You will not have this, I suspect, and you need a sound and location and files for sounds to work, so leave the SND part out.

Code:
<!--learjet24_gen_left-->

<PartInfo>
        <Name>learjet24_gen_left</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
              <Code>
                 (L:LEFT_GEN_SELECT_POS,number)
              </Code>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipText>Left Generator Starter Selector</TooltipText>
    <MouseFlags>LeftSingle+LeftRelease+LeftDrag+Wheel</MouseFlags>
    <CallbackCode>
      (M:Event) 'LeftSingle' scmp 0 ==
      if{
        (M:Y) (&gt;L:LEFT_GEN_MOUSEPOS,number)
                 1 (&gt;L:XMLSND1,enum)
        quit
      }
   
      (M:Event) 'LeftDrag' scmp 0 ==
      if{
        (M:Y) (L:LEFT_GEN_MOUSEPOS,number) - -1.0 * (L:LEFT_GEN_SELECT_POS,number) + 0 max 50 min (&gt;L:LEFT_GEN_SELECT_POS,number)
        (M:Y) (&gt;L:LEFT_GEN_MOUSEPOS,number)
                   quit
            (M:Y) (L:LEFT_GEN_SELECT_POS,number) 3 &lt;
                    if{ (A:GENERAL ENG STARTER:1, bool) 0 ==
                      if{ (>K:TOGGLE_STARTER1) } }
      }
   
      (M:Event) 'LeftRelease' scmp 0 ==
      if{
            (M:Y) (L:LEFT_GEN_SELECT_POS,number) 5 &lt;
        if{
                25 (&gt;L:LEFT_GEN_SELECT_POS,number)
                 1 (&gt;L:XMLSND1,enum)

        }
        (M:Y) 6 45 (L:LEFT_GEN_SELECT_POS,number) rng
        if{
                25 (&gt;L:LEFT_GEN_SELECT_POS,number)
                   (A:GENERAL ENG GENERATOR SWITCH:1, bool) 1 ==
                     if{ (>K:TOGGLE_ALTERNATOR1) }
                   (A:GENERAL ENG STARTER:1, bool) 1 ==
                     if{ (>K:TOGGLE_STARTER1) }

        }
        (M:Y) (L:LEFT_GEN_SELECT_POS,number) 46 &gt;
        if{
                50 (&gt;L:LEFT_GEN_SELECT_POS,number)
                   (>K:TOGGLE_ALTERNATOR1)
        }
      }
            </CallbackCode>
        </MouseRect>
    </PartInfo>

<!--learjet24_gen_right-->

<PartInfo>
        <Name>learjet24_gen_right</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
              <Code>
                 (L:RIGHT_GEN_SELECT_POS,number)
              </Code>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipText>Right Generator Starter Selector</TooltipText>
    <MouseFlags>LeftSingle+LeftRelease+LeftDrag+Wheel</MouseFlags>
    <CallbackCode>
      (M:Event) 'LeftSingle' scmp 0 ==
      if{
        (M:Y) (&gt;L:RIGHT_GEN_MOUSEPOS,number)
                 1 (&gt;L:XMLSND1,enum)
        quit
      }
   
      (M:Event) 'LeftDrag' scmp 0 ==
      if{
        (M:Y) (L:RIGHT_GEN_MOUSEPOS,number) - -1.1 * (L:RIGHT_GEN_SELECT_POS,number) + 0 max 50 min (&gt;L:RIGHT_GEN_SELECT_POS,number)
        (M:Y) (&gt;L:RIGHT_GEN_MOUSEPOS,number)
              quit
                  (L:RIGHT_GEN_SELECT_POS,number) 0 &lt;
                    if{ (A:GENERAL ENG STARTER:2, bool) 0 ==
                      if{ (>K:TOGGLE_STARTER2) } }
      }
   
      (M:Event) 'LeftRelease' scmp 0 ==
      if{
            (M:Y) (L:RIGHT_GEN_SELECT_POS,number) 5 &lt;
        if{
                25 (&gt;L:RIGHT_GEN_SELECT_POS,number)
                 1 (&gt;L:XMLSND1,enum)
        }
        (M:Y) 6 45 (L:RIGHT_GEN_SELECT_POS,number) rng
        if{
                25 (&gt;L:RIGHT_GEN_SELECT_POS,number)
                   (A:GENERAL ENG GENERATOR SWITCH:2, bool) 1 ==
                     if{ (>K:TOGGLE_ALTERNATOR2) }
                   (A:GENERAL ENG STARTER:2, bool) 1 ==
                     if{ (>K:TOGGLE_STARTER2) }
        }
        (M:Y) (L:RIGHT_GEN_SELECT_POS,number) 46 &gt;
        if{
                50 (&gt;L:RIGHT_GEN_SELECT_POS,number)
                   (>K:TOGGLE_ALTERNATOR2)
        }
      }
            </CallbackCode>
        </MouseRect>
    </PartInfo>


I used 50 key frames for animation on this. 0, 25, 50.
 
Messages
1,451
Country
mexico
Hello Bill

Right now, I am axperimenting with my original 2D Gauge and the inclusion of Heretic's code; I will compare notes and try to adjust. I think I have the right ingredients for a recipe; now I need to learn how to mix them correctly :confused: :confused: :confused:

Thank you very much.
All the best,
Sergio.
 
Messages
1,451
Country
mexico
Hello lads

I discovered that some variables cannot be discarded; to be more specific L:Eng2StarterSwitch and L:Eng3StarterSwitch. Another gauge perform special tasks to assign variables values at certain conditions; so, they must remain in the code. Altough Heretic's code is brilliant, he was not aware of this fact and that's why engine 3 (for simulation purposes, engine 2) wasn't starting. So, one more time, I was doing crazy things to see what happened and I got this including the controller. Of course, is crude and it has total lack of elegance but for now it does what is supposed to do. This is the 2D gauge working version:

HTML:
<!-- Starter Behavior using the controller-->
      <Element>
            <Select>
                  <Value>
                        (A:Turb eng2 N1, percent) 55 &gt;
                                if{ 0 (&gt;L:Eng2StarterSwitch, bool) } ||
                                if{ 0 (&gt;L:429_Starter_switch_control, number) }
                          
                        (A:Turb eng3 N1, percent) 55 &gt;
                                if{ 0 (&gt;L:Eng3StarterSwitch, bool) } ||
                                if{ 0 (&gt;L:429_Starter_switch_control, number) }

                        (L:429_Starter_switch_control, number) 1 == (L:Eng2StarterSwitch, bool) 1 == &amp;&amp;
                        if{ (L:Eng3Running,bool) if{ (A:General Eng3 Master Alternator, bool) 1 == (A:Turb eng3 N1, percent) 60 &gt; &amp;&amp; if{ (&gt;K:TOGGLE_STARTER2) } }
                        els{ (A:Electrical Master Battery,bool) if{ (&gt;K:TOGGLE_STARTER2) } } }

                        (L:429_Starter_switch_control, number) 2 == (L:Eng3StarterSwitch, bool) 1 == &amp;&amp;
                        if{ (L:Eng2Running,bool) if{ (A:General Eng2 Master Alternator, bool) 1 == (A:Turb eng2 N1, percent) 60 &gt; &amp;&amp; if{ (&gt;K:TOGGLE_STARTER3) } }
                        els{ (A:Electrical Master Battery,bool) if{ (&gt;K:TOGGLE_STARTER3) } } }
                  </Value>
            </Select>
      </Element>

Now, the 2D mouse areas:
HTML:
<!-- 2D engine starter switch using original clickspots -->
<!-- Starter Switches -->
      <Area Left="490" Top="30" Width="35" Height="35">
          <Cursor Type="Hand"/>
              <Click Repeat="Yes" MouseWheelFlip="No">
                  1 (&gt;L:429_Starter_switch_control, number)
                  1 (&gt;L:Eng2StarterSwitch, bool)
              </Click>
      </Area>

      <Area Left="527" Top="30" Width="35" Height="35">
          <Cursor Type="Hand"/>
              <Click Repeat="Yes" MouseWheelFlip="No">
                  0 (&gt;L:429_Starter_switch_control, number)
                  0 (&gt;L:Eng2StarterSwitch, bool)
                  0 (&gt;L:Eng3StarterSwitch, bool)
              </Click>
      </Area>

      <Area Left="564" Top="30" Width="35" Height="35">
          <Cursor Type="Hand"/>
              <Click Repeat="Yes" MouseWheelFlip="No">
                  2 (&gt;L:429_Starter_switch_control, number)
                  1 (&gt;L:Eng3StarterSwitch, bool)
              </Click>
      </Area>

A sad part, I don't understand quiet well mouse events; so I am trying to make the 3D object to work with only left clicks. As you can see, I used a new variable: L:429_Starter_switch_position. If my assumptions are right, this should be happening:
  1. Each left mouse click will increase L:429_Starter_switch_control by one in a cicle. This is done within the callback_code (L:429_Starter_switch_control, number) ++ 3 % (&gt;L:429_Starter_switch_control, number). I toke borrowed a table to see how a simple left click will affect the gauge.
  2. For each case when L:429_Starter_switch_control change its value, I am assigning a value to L:429_Starter_switch_position, L:Eng2StarterSwitch and L:Eng3StarterSwitch.
  3. If everything is ok with the part code, L:429_Starter_switch_position now is controlling the 3D part animation using keys 0 (to start engine 2), 25 as neutral position and 50 to start engine 3. In order to do that, I am testing this new code to controll the animation: (L:429_Starter_switch_position, number) 1 - 25 *
  4. I haven't tested yet, but the new part code is this:
HTML:
<!-- In the VC:
       The following script shows how to increment the custom (L:429_Starter_switch_control) value by 1 on each "click". The number preceeding the modulo operator (%)
      is the reset point (highcount + 1), at which point the variable will reset back to zero.

      NOTE: this technique works for integers only. Fractional increment/decrement should use other methods.

      0 + click = 1; 1 mod 3 = 1
      1 + click = 2; 2 mod 3 = 2
      2 + click = 0; 3 mod 3 = 0
-->

      <part>
          <name>bell429_starter_switch</name>
              <animation>
                  <parameter>
                      <code>
                          (L:429_Starter_switch_position, number) 1 - 25 *
                      </code>
                      <lag>100</lag>
                  </parameter>
              </animation>
              <mouserect>
              <cursor>Hand</cursor>
              <tooltip_text>Starter Switch</tooltip_text>
              <callback_code>
                  (L:429_Starter_switch_control, number) ++ 3 % (&gt;L:429_Starter_switch_control, number)
            
                  (L:429_Starter_switch_control, number) 1 ==
                  if{ 1 (&gt;L:Eng2StarterSwitch, bool)
                      1 (&gt;L:429_Starter_switch_position, number) }
            
                  (L:429_Starter_switch_control, number) 2 ==
                  if{ 1 (&gt;L:Eng3StarterSwitch, bool)
                      3 (&gt;L:429_Starter_switch_position, number) }
            
                  (L:429_Starter_switch_control, number) 0 ==
                  if{ 0 (&gt;L:Eng2StarterSwitch, bool)
                      0 (&gt;L:Eng3StarterSwitch, bool)
                      2 (&gt;L:429_Starter_switch_position, number) }
              </callback_code>
              </mouserect>
      </part>

As soon as I test this, I will let you know if it worked. Please bear in mind that I am doing my first steps in XML scripting and in every test I am pushing my limits as well.
Sergio.
 
Last edited:
Messages
1,451
Country
mexico
Hi lads

Now we're talking about! Now 3D object and 2D gauge are doing something useful; after doing 2 or 3 start procedures, I have verified its integrity. Nevetheless, I need to refine the 3D animation code; it animates in the 3 positions as it should but it doesn't start in the neutral position when engines are ON.

So, evidently I am still missing something... In some way, I need to "melt" this part of code within the 2D gauge in the callback_code: :scratchch :scratchch :scratchch :scratchch
HTML:
                        (A:Turb eng2 N1, percent) 55 &gt;
                                if{ 0 (&gt;L:Eng2StarterSwitch, bool) } ||
                                if{ 0 (&gt;L:429_Starter_switch_control, number) }
                           
                        (A:Turb eng3 N1, percent) 55 &gt;
                                if{ 0 (&gt;L:Eng3StarterSwitch, bool) } ||
                                if{ 0 (&gt;L:429_Starter_switch_control, number) }

Perhaps, something like this:
HTML:
      <part>
          <name>bell429_starter_switch</name>
              <animation>
                  <parameter>
                      <code>
                          (L:429_Starter_switch_position, number) 1 - 25 *
                      </code>
                      <lag>100</lag>
                  </parameter>
              </animation>
              <mouserect>
              <cursor>Hand</cursor>
              <tooltip_text>Starter Switch</tooltip_text>
              <callback_code>
                   (A:Turb eng2 N1, percent) 55 &gt;
                   (A:Turb eng3 N1, percent) 55 &gt; ||
                        if{ 2 (&gt;L:429_Starter_switch_position, number) }

                  (L:429_Starter_switch_control, number) ++ 3 % (&gt;L:429_Starter_switch_control, number)
               
                        (L:429_Starter_switch_control, number) 1 ==
                        if{ 1 (&gt;L:Eng2StarterSwitch, bool)
                             1 (&gt;L:429_Starter_switch_position, number) }
                     
                        (L:429_Starter_switch_control, number) 2 ==
                        if{ 1 (&gt;L:Eng3StarterSwitch, bool)
                             3 (&gt;L:429_Starter_switch_position, number) }
                     
                        (L:429_Starter_switch_control, number) 0 ==
                        if{ 0 (&gt;L:Eng2StarterSwitch, bool)
                             0 (&gt;L:Eng3StarterSwitch, bool)
                             2 (&gt;L:429_Starter_switch_position, number) }
              </callback_code>
              </mouserect>
      </part>

Well, I am happy to learn what I have assumed is right! We're almost there! :D :D :D :D :D

Thank you all, I mean it! I wouldn't do this without your help.
All the best,
Sergio.
;)
 
Last edited:

taguilo

Resource contributor
Messages
1,585
Country
argentina
Sergio,

I've inspected your code, taking into account it is for FS2004. Years have passed since I did my last works on that version, even I don't have it installed any more.
But providing I recall correctly, STARTER events must be fired continuosly to make the engine spool; also code placed in VC gauges/ 3D modeldef is always visible no matter current view is 2D main panel or 3D VCockpit, the same as in FSX, right?

Therefore, and if my memories are good, you could use a code like this one:

3D VC part

Code:
               <animation>
                  <parameter>
                      <code>     
                        (A:Turb eng2 N1, percent) 55 > (L:429_Starter_switch_control, number) 1 == and
                        (A:Turb eng3 N1, percent) 55 > (L:429_Starter_switch_control, number) -1 == and
                        or
                        if{ 0 (>L:429_Starter_switch_control, number) }
                        (L:429_Starter_switch_control, number) 1 == (A:Electrical Master Battery,bool) and
                        if{ (>K:TOGGLE_STARTER2) }
                        (L:429_Starter_switch_control, number) -1 == (A:Electrical Master Battery,bool) and
                        if{ (>K:TOGGLE_STARTER3) }
                        (L:429_Starter_switch_control, number) s0 0 &lt; 50 * l0 0 == 25 * +
                      </code>
                      <lag>100</lag>
                  </parameter>
              </animation>
        <mouserect>
        <callback_code>
            (M:Event) 'LeftSingle' scmp 0 ==
            if{ (L:429_Starter_switch_control, number) ++ 1 min (>L:429_Starter_switch_control, number) }
            (M:Event) 'RightSingle' scmp 0 ==
            if{ (L:429_Starter_switch_control, number) -- -1 max (>L:429_Starter_switch_control, number) }
        </callback_code>

And in the 2D panel:

Code:
     <Element>
       <Select>
         <Value> (L:429_Starter_switch_control, number) </Value>
         <Case Value="1">
         ***IMG for starter left
         </Case>
         <Case Value="0">
         ***IMG for starter off
         </Case>
         <Case Value="-1">
         ***IMG for starter right
         </Case>
       </Select>
     </Element>   

     <!-- Starter Switches -->
     <Area Left="490" Top="30" Width="35" Height="35">
        <Cursor Type="Hand"/>
        <Click Repeat="Yes" MouseWheelFlip="No">
          1 (>L:429_Starter_switch_control, number)
        </Click>
     </Area>

     <Area Left="527" Top="30" Width="35" Height="35">
       <Cursor Type="Hand"/>
       <Click Repeat="Yes" MouseWheelFlip="No">
         0 (>L:429_Starter_switch_control, number)
        </Click>
     </Area>

     <Area Left="564" Top="30" Width="35" Height="35">
       <Cursor Type="Hand"/>
       <Click Repeat="Yes" MouseWheelFlip="No">
          -1 (>L:429_Starter_switch_control, number)
       </Click>
     </Area>

The logic for engaging both starters goes in the 3D model, which "should" be always visible. Rest is simple.
BTW, for reality sake, you only need to check Battery Bus is powered to start any of the engines. Despite the second engine will start after the first is running with its generator ON, it should not be possible to start it with generator power only, as this one cannot deliver more than 300 Amps, and the starter will draw as much as 1000 Amps at the beginning of the process, thus making the generator trip off if it is not aided by battery power. Besides, I believe starter switch should be unpowered with Battery Bus off, like in real life.

Please check the entire code, for obvious reasons I wasn't able to test it.

Tom

PS: I really don't understand the need to use eng 2 & 3 instead of 1 & 2 ...
 
Last edited:
Messages
1,451
Country
mexico
Hi Tom!



PS: I really don't understand the need to use eng 2 & 3 instead of 1 & 2 ...
Well, we used engine one to drive main and tail rotor animations controlled by another gauge (it's named simply "engine_control"). It also, provides a new way to "fool" FS9 in order to use the sound system as a real twin engine helicopter. So, If one engine is off, the second is providing power to the tail and main rotorshafts. That's why we use it in that way.

On the other hand, I haven't published updated version of this gauge. I will test your version and let you know the operational results. I really appreciate the time and effort made by all of you by helping me to solve this issue; I am really thankful.

In an effort to uncover "some secrets", I will attach the "Engine_control" gauge if someone is willing to take a look of it. I need to clarify that this code was kindly provided by Jordan Moore; I don't wrote any of its content. He was kind enough to let me use it and I am trying very hard to make sense of it.

As a side note, I am very thankful as well with the next gentleman -they did the same for me-:
Fr. Bill Leaming, William Ortis, Thomas Röhl, George Arana, Ken Mitchell, Uwe Inger, Jean-Pierre Langer, Arne Bartels, Milton Shupe, Don Kuhn, Antti Pankkonen and Manuel Gonzalez.


Greetings and thank you very much.
All the best,
Sergio.
 

Attachments

  • engine_control.txt
    8.7 KB · Views: 511
Last edited:
Messages
1,451
Country
mexico
Hi Tom

But providing I recall correctly, STARTER events must be fired continuosly to make the engine spool; also code placed in VC gauges/ 3D modeldef is always visible no matter current view is 2D main panel or 3D VCockpit, the same as in FSX, right?

I forgot to mention that in this regard, I don't know nothing about FSX and I certainly don't use it. George is dealing with this version :duck::duck::duck:

Cheers,
Sergio.
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
Sergio,

It seems "EngineControl" gauge is placed in [VCockpit] section?
If so, then simply move the logic to that gauge. I also noticed that some variables need to be present and with proper values.

So another example:

2D Control gauge:

Code:
<Gauge Name="EngineControl" Version="1.0">
<Update Frequency="6"/>
     ...............
     ................
     <!--  Starter Behavior -->    
     <Element>
              <Select>
                    <Value>
                     
                        (A:Turb eng2 N1, percent) 55 > (L:429_Starter_switch_control, number) 1 == and
                        if{ 0 (>L:429_Starter_switch_control, number)  }
                        (A:Turb eng3 N1, percent) 55 > (L:429_Starter_switch_control, number) -1 == and
                        if{ 0 (>L:429_Starter_switch_control, number) }

                        (L:429_Starter_switch_control, number) 1 == (A:Electrical Master Battery,bool) and
                        d (>L:Eng2StarterSwitch, bool) if{ (>K:TOGGLE_STARTER2) }
                        (L:429_Starter_switch_control, number) -1 == (A:Electrical Master Battery,bool) and
                        d (>L:Eng3StarterSwitch, bool) if{ (>K:TOGGLE_STARTER3) }
                    </Value>
              </Select>
        </Element>
        ..............
</Gauge>

2D Mouse section for the switch may remain the same. Expect perhaps a tiny lag from switch selection to switch animation as the gauge's frequency is lower than 18 Hz standard.

I am trying to make the 3D object to work with only left clicks

I don't think that is reasonable. Starting from neutral, one left click will start engine2 and next left click will start engine3, but coming from eng2start position, which would not be correct. Besides, if after engine2 start routine the switch trips to neutral, there is no way to start engine3 than passing through eng2 start (!)

Anyway, if you want to try a code to run trough neutral-left-right with left click only, this one could be appropriate:

Code:
  (L:429_Starter_switch_control, number) ++ d 1 > -3 * + (>L:429_Starter_switch_control, number)

Always being 1 left, 0 neutral and -1 right. Simple and clean

Tom
 
Messages
1,451
Country
mexico
Hello Tom

It seems "EngineControl" gauge is placed in [VCockpit] section?
If so, then simply move the logic to that gauge. I also noticed that some variables need to be present and with proper values.

Your code is brilliant! Nevertheless, I can activate actions for engine 3 (right position) from the VC. It works incredibly well if I do all from the 2D panel. As you mentioned, some variables were missing. And no, Engine_control gauge is in the main 2D panel; I will swap its position to the first VC entry within the panel.cfg. Here is the most up to date script:

2D gauge code:
HTML:
       <!-- Starter Switching -->
     <Element>
     <Position X="527" Y="29"/>
       <Select>
             <Value>(L:429_Starter_switch_control, number)</Value>
                 <Case Value="1">
                    <Image Name="429_switch_red_LFTsm.bmp"/>
                 </Case>
                 <Case Value="0">
                    <Image Name="429_switch_red_CTRsm.bmp"/>
                 </Case>
                 <Case Value="-1">
                    <Image Name="429_switch_red_RTsm.bmp"/>
                 </Case>
       </Select>
     </Element>

Mouse areas in the 2D panel:
HTML:
     <!-- Starter Switches -->
         <Area Left="490" Top="30" Width="35" Height="35">
                <Cursor Type="Hand"/>
                <Click Repeat="Yes" MouseWheelFlip="No">
                    1 (&gt;L:429_Starter_switch_control, number)
                </Click>
         </Area>

         <Area Left="527" Top="30" Width="35" Height="35">
               <Cursor Type="Hand"/>
               <Click Repeat="Yes" MouseWheelFlip="No">
                   0 (&gt;L:429_Starter_switch_control, number)
                </Click>
         </Area>

         <Area Left="564" Top="30" Width="35" Height="35">
               <Cursor Type="Hand"/>
               <Click Repeat="Yes" MouseWheelFlip="No">
                    -1 (&gt;L:429_Starter_switch_control, number)
               </Click>
         </Area>

And the version using the missing variables for the 3D part:
HTML:
      <part>
          <name>bell429_starter_switch</name>
               <animation>
                  <parameter>
                      <code>
                        (A:Turb eng2 N1, percent) 55 &gt; (L:429_Starter_switch_control, number) 1 == &amp;&amp;
                        (A:Turb eng3 N1, percent) 55 &gt; (L:429_Starter_switch_control, number) -1 == &amp;&amp;
                        ||
                            if{ 0 (&gt;L:429_Starter_switch_control, number) }
                      
                        (L:429_Starter_switch_control, number) 1 == (A:Electrical Master Battery,bool) &amp;&amp;
                            if{ (L:Eng3Running,bool) if{ (A:General Eng3 Master Alternator, bool) 1 == (A:Turb eng3 N1, percent) 60 &gt; &amp;&amp; if{ (&gt;K:TOGGLE_STARTER2) } }
                            els{ (A:Electrical Master Battery,bool) if{ (&gt;K:TOGGLE_STARTER2) } } }
                      
                        (L:429_Starter_switch_control, number) -1 == (A:Electrical Master Battery,bool) &amp;&amp;
                            if{ (L:Eng2Running,bool) if{ (A:General Eng2 Master Alternator, bool) 1 == (A:Turb eng2 N1, percent) 60 &gt; &amp;&amp; if{ (&gt;K:TOGGLE_STARTER3) } }
                            els{ (A:Electrical Master Battery,bool) if{ (&gt;K:TOGGLE_STARTER3) } } }

                        (L:429_Starter_switch_control, number) s0 0 &lt; 50 * l0 0 == 25 * +
                      </code>
                      <lag>100</lag>
                  </parameter>
              </animation>
        <mouserect>
        <cursor>Hand</cursor>
        <tooltip_text>Starter Switch</tooltip_text>
        <callback_code>
            (M:Event) 'LeftSingle' scmp 0 ==
                if{ (L:429_Starter_switch_control, number) ++ 1 min (&gt;L:429_Starter_switch_control, number) }
            (M:Event) 'RightSingle' scmp 0 ==
                if{ (L:429_Starter_switch_control, number) -- -1 max (&gt;L:429_Starter_switch_control, number) }
        </callback_code>
        </mouserect>
      </part>


As I mentioned, I can see all working and communicating perfectly (2D and VC) if I start both engines from the 2D panel. If I do the same from the VC, I am able only to start engine 2; for some reason I can't do the right click. The animation is perfect now, almost there!!!

Thank you!
Sergio.

P.S. the only line of code that I don't fully understand is this. I know that it enables registers to assign values... nothing else :oops:
HTML:
(L:429_Starter_switch_control, number) s0 0 &lt; 50 * l0 0 == 25 * +
 
Last edited:
Messages
1,451
Country
mexico
Ohhhh!!!! I think I spotted a potential problem!

I will try both conditions in the 3D part without using (A:Electrical Master Battery,bool) and. In short, this code:
HTML:
     <part>
          <name>bell429_starter_switch</name>
               <animation>
                  <parameter>
                      <code>
                        (A:Turb eng2 N1, percent) 55 &gt; (L:429_Starter_switch_control, number) 1 == &amp;&amp;
                        (A:Turb eng3 N1, percent) 55 &gt; (L:429_Starter_switch_control, number) -1 == &amp;&amp;
                        ||
                            if{ 0 (&gt;L:429_Starter_switch_control, number) }
                      
                        (L:429_Starter_switch_control, number) 1 ==
                            if{ (L:Eng3Running,bool) if{ (A:General Eng3 Master Alternator, bool) 1 == (A:Turb eng3 N1, percent) 60 &gt; &amp;&amp; if{ (&gt;K:TOGGLE_STARTER2) } }
                            els{ (A:Electrical Master Battery,bool) if{ (&gt;K:TOGGLE_STARTER2) } } }
                      
                        (L:429_Starter_switch_control, number) -1 ==
                            if{ (L:Eng2Running,bool) if{ (A:General Eng2 Master Alternator, bool) 1 == (A:Turb eng2 N1, percent) 60 &gt; &amp;&amp; if{ (&gt;K:TOGGLE_STARTER3) } }
                            els{ (A:Electrical Master Battery,bool) if{ (&gt;K:TOGGLE_STARTER3) } } }

                        (L:429_Starter_switch_control, number) s0 0 &lt; 50 * l0 0 == 25 * +
                      </code>
                      <lag>100</lag>
                  </parameter>
              </animation>
        <mouserect>
        <cursor>Hand</cursor>
        <tooltip_text>Starter Switch</tooltip_text>
        <callback_code>
            (M:Event) 'LeftSingle' scmp 0 ==
                if{ (L:429_Starter_switch_control, number) ++ 1 min (&gt;L:429_Starter_switch_control, number) }
            (M:Event) 'RightSingle' scmp 0 ==
                if{ (L:429_Starter_switch_control, number) -- -1 max (&gt;L:429_Starter_switch_control, number) }
        </callback_code>
        </mouserect>
      </part>

I will be back as soon as I test this on the sim.
:)
 
Messages
1,451
Country
mexico
It didn't worked... still I can't enable right position from the VC using a right mouse click. Removing (A:Electrical Master Battery,bool) didn't affect the overall behavior; a complete mystery for me :scratchch :scratchch :scratchch

I will keep you posted.
:wave:
 
Top