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

P3D v2 Turbine Starter Switch

Messages
10,163
Country
us-arizona
Hey guys,

I wish to make a starter switch that must behave a certain way and I cant find anything similar in the existing ModelDef, but I found something close.

On the Lear, you have two switches that have;
* Generator (up position)
* Off (middle position)
* Starter Mode (hold down for 'starter on' )

What I 'really really really' want is to be able to hold the mouse down on that starter toggle (drag it down, then release for off-starter) and after the engine ignites, click up two times to 'Generator mode on' position (top). Center would be off as stated.

Can it be done? Holding the mouse 'down' for startups?



Existing code;

Code:
    <PartInfo>
        <Name>switch_generator_starter1</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Code>(A:GENERAL ENG GENERATOR SWITCH:2, bool) d if{ (A:GENERAL ENG STARTER:2, bool) } + 25 *</Code>
                <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <HelpID>HELPID_GAUGE_STARTER_SWITCH</HelpID>
            <TooltipID>TOOLTIPTEXT_ENG2_STARTER_SWITCH</TooltipID>
            <MouseFlags>LeftSingle+LeftDrag+MoveRepeat+Wheel</MouseFlags>
            <CallbackCode>(M:Event) 'LeftSingle' scmp 0 ==
                if{ (M:X) (>G:Var1) (A:GENERAL ENG GENERATOR SWITCH:2, bool) d if{ (A:GENERAL ENG STARTER:2, bool) } +  (>G:Var2) }
                els{ (M:X) (G:Var1) - 40 / int (G:Var2) + 0 max 2 min s0
                    l0 0 == if{ (A:GENERAL ENG GENERATOR SWITCH:2, bool) if{ (>K:TOGGLE_ALTERNATOR2) } }
                    l0 1 == if{ (A:GENERAL ENG GENERATOR SWITCH:2, bool) ! if{ (>K:TOGGLE_ALTERNATOR2) } }
                    l0 2 == if{ (A:GENERAL ENG GENERATOR SWITCH:2, bool) ! if{ (>K:TOGGLE_ALTERNATOR2) } (>K:TOGGLE_STARTER2) }
                }
            </CallbackCode>
        </MouseRect>
    </PartInfo>
 
I was just thinking... If one could up-drag and down-drag an object, they could flip past 2 enums easy, couldn't they? For instance, if its in off position (middle) and you were to mouse drag it down and keep the left key depressed and hold it to start the turbine, then drag it up to the top for Generator mode, would that work?

It would be nice to have it drag/release for bottom 'start' mode, then flip it up to Generator mode from off (middle) position.
 
Bill,

What you want to accomplish isn't really difficult to code in the <CallBackCode> section, but personally I would suggest that you consider the chance to use Left and Right mouse clicks instead of Drag, as to make it as simple as possible.
For example, Left Clik to switch down and Right Click to switch Up. The Starter position would have a LeftRelease flag as to spring back to Off.
If you agree I can give you an example on how to make the code.

Tom
 
Hey Tom,

Sounds like a plan. I wanted drag so that I could replicate the feeling of actually flipping the toggle, mouse movement. But I'll do what ever it takes to at least get proper functionality to the switch working and its animation being proper.

Anyways, I would really need 'up drag' and 'down drag'. But, as I recall, someone figured that out (down in New Zealand) how to mouse drag things/objects. I forgot about that.

And many thanks, by the way. Massively appreciated.
 
Found it. This is a code that was modified from Otmar Nitsche's findings on screen/mouse/movement input, using distance or pixels as a scaler for object movement, like a manual slider.

Would this at all work in such a 3 position switch?

Code:
<PartInfo>
        <Name>dr400_canopy</Name>
<Animation>
  <Parameter>
   <Code>
    (L:DR400 Canopy Latch INITIALIZED,bool) 0 ==
    if{
      99 (&gt;L:DR400 CANOPY LATCH, number)
      1 (>L:DR400 Canopy Latch INITIALIZED,bool)
    }  
    100 (L:DR400 CANOPY LATCH, number) -
   </Code>
  </Parameter>
</Animation>
    <MouseRect>
        <Cursor>Hand</Cursor>
       <TooltipText>Canopy; Pull down to open, up to close</TooltipText>
       <MouseFlags>LeftSingle+LeftDrag</MouseFlags>
    <CallbackCode>
    (M:Event) 'LeftSingle' scmp 0 ==
    if{
      100 (M:Y) - (&gt;L:DR400_CANOPY_MOUSEPOS,number)
      quit
    }
    (M:Event) 'LeftDrag' scmp 0 ==
    if{
      100 (M:Y) - (L:DR400_CANOPY_MOUSEPOS,number) - 0.1 * (L:DR400 CANOPY LATCH, number) + 0 max 100 min (&gt;L:DR400 CANOPY LATCH, number)
      100 (M:Y) - (L:DR400_CANOPY_MOUSEPOS,number)
    }
    </CallbackCode>
    </MouseRect>
</PartInfo>
 
I found this stock animation starter in the bottom of the ModelDef. Odd... I changed it to Y movement, inverted it, very goofy... It has 3 positions even, but two are 'off' and one is on and there is so little control, you cant seem to mouse wheel it, and the drag animation control is practically nill. I increased the Y movement axis from 12 to 24 and that did nothing for it.

Perhaps mouse wheel up and mouse wheel down for Generator on/off would work for that segment, then Left Click + left release would work for the starter portion.

Man, I get all these cool ideas in my head on how to build these birds and their controls, but implementing them is so dang difficult.

Code:
    <PartInfo>
        <Name>learjet24_gen_right</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                    (A:General eng starter:1, bool) s0 (A:General eng starter:2, bool) s1 + 0 ==
                    if{ 25 } els{
                    l0 if{ 0 } els{
                        l1 if{ 50 }
                        }
                    }
                </Code>
                <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipID>TOOLTIPTEXT_ENG1_STARTER_SWITCH</TooltipID>
            <MouseFlags>LeftSingle+LeftDrag+Wheel</MouseFlags>
            <CallbackJumpDragging>
                <YMovement>
                    <Delta>-24</Delta>
                    <EventIdInc>TOGGLE_STARTER2</EventIdInc>
                    <EventIdDec>TOGGLE_STARTER1</EventIdDec>
                </YMovement>
            </CallbackJumpDragging>
      </MouseRect>
    </PartInfo>
 
Anyways, I would really need 'up drag' and 'down drag'.

Ok Bill, here you have an example that should work:


Code:
   <PartInfo>
        <Name>switch_generator_starter1</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Code>(A:GENERAL ENG GENERATOR SWITCH:2, bool) 25 * (A:GENERAL ENG STARTER:2, bool) -25 * +</Code>
                <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <HelpID>HELPID_GAUGE_STARTER_SWITCH</HelpID>
            <TooltipID>TOOLTIPTEXT_ENG2_STARTER_SWITCH</TooltipID>
            <MouseFlags>LeftDrag+LeftRelease+WheelUp</MouseFlags>
            <CallbackCode>
                      (M:Event) 'LeftDrag' scmp 0 ==                     
                      (M:Event) 'WheelUp' scmp 0 == or
                      if{ 100 (M:Y) - s0 30 &lt; if{ -25 }
                            30 70 l0 rng if{ 0 }
                             l0 70 > if{ 25 }                           
                             (>L:StarterGenSwitch2,number)
                         }
                      (M:Event) 'LeftRelease' scmp 0 ==                                           
                      100 (M:Y) - 30 &lt; and
                      if{ 0 (>L:StarterGenSwitch2,number) }
                      (L:StarterGenSwitch2,number) sp0
                      l0 -25 == (A:GENERAL ENG STARTER:2, bool) ! and if{ (>K:TOGGLE_STARTER2) }
                      l0 0 == (A:GENERAL ENG STARTER:2, bool) and if{ (>K:TOGGLE_STARTER2) }
                      l0 0 == (A:GENERAL ENG GENERATOR SWITCH:2, bool) and if{ (>K:TOGGLE_ALTERNATOR2) }
                      l0 25 == (A:GENERAL ENG GENERATOR SWITCH:2, bool) ! and if{ (>K:TOGGLE_ALTERNATOR2) }
            </CallbackCode>
        </MouseRect>
    </PartInfo>

Suppositions:
-Mouse area's height is 100 pixels (Y scale) . Upper and lower halves are both 30 pix and center is 40 pix.
-Animation goes from -25 (Starter) to 0 Off to 25 (generator)
-LVar control's value range also goes from -25 to 25 as to match the animation scale (could have been -1 to 1 as well).

Please make proper adjustments as to meet your own requirements.

Hope this helps.

Tom
 
Tom, you did so much work on this, I didn't want to tell you, this doesn't work and I cannot totally understand the code functionality, so I wasn't able to do too much with it. I see how save and load work (s0 and L0), and how the switch travels from positions -25 to zero to 25. But I couldn't figure out or diagnose what is going on with the error.

The switch moves from off to down position (turbine starter mode) and stays there, not moving up.


Just to verify, does this following basically mean the secondary?

(L:StarterGenSwitch2,number) sp0 <-- this is saying 'save zero entry as (L:StarterGenSwitch2,number)
l0 -25 == (A:GENERAL ENG STARTER:2, bool) ! and if{ (>K:TOGGLE_STARTER2) }
l0 0 == (A:GENERAL ENG STARTER:2, bool) and if{ (>K:TOGGLE_STARTER2) }
l0 0 == (A:GENERAL ENG GENERATOR SWITCH:2, bool) and if{ (>K:TOGGLE_ALTERNATOR2) }
l0 25 == (A:GENERAL ENG GENERATOR SWITCH:2, bool) ! and if{ (>K:TOGGLE_ALTERNATOR2) }

(is the below a duplicate of above?)

(L:StarterGenSwitch2,number) -25 == (A:GENERAL ENG STARTER:2, bool) ! and if{ (>K:TOGGLE_STARTER2) }
(L:StarterGenSwitch2,number) 0 == (A:GENERAL ENG STARTER:2, bool) and if{ (>K:TOGGLE_STARTER2) }
(L:StarterGenSwitch2,number) 0 == (A:GENERAL ENG GENERATOR SWITCH:2, bool) and if{ (>K:TOGGLE_ALTERNATOR2) }
(L:StarterGenSwitch2,number) 25 == (A:GENERAL ENG GENERATOR SWITCH:2, bool) ! and if{ (>K:TOGGLE_ALTERNATOR2) }

And may I ask what this does;

(M:Event) 'LeftRelease' scmp 0 ==
100 (M:Y) - 30 &lt; and
if{ 0 (>L:StarterGenSwitch2,number) }


I do not understand how 100 plays a part in the (M:Y) coding. Do you normally put the maximum pixel travel in front of the (M:Y) section and why do you have -30? Is that a reset point?

EDIT: Ok, sorry. 100 pixels is total mouse movement zone, and so if the switch moves to one of those three area's, it is to lock at one of 3 KF points and thus a command is activated when the object is at certain positions.

Sorry for all the questions.
 
Last edited:
EDIT: Ok, sorry. 100 pixels is total mouse movement zone, and so if the switch moves to one of those three area's, it is to lock at one of 3 KF points and thus a command is activated when the object is at certain positions.

Sorry for all the questions.

Ok Bill, no problem at all :)
I'm glad that you seem to have figured out how this stuff works..

Tom
 
Ok, I have been working on how to understand this code (mouse dragging) for several days now. I have written a ton of variations of mouse dragging code and nothing is working. Now and then (like 2 times today) I got a single movement, but nothing else. ACK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I have roamed through the ModelDef examining other mouse dragging codes, I have studied yours Tom, I have studied my fuel selector and others, and I cannot make anything work how I want it to work. If I take a 4 position that Bill Leaming posted here and change it to a 3 position (what I need) it stops working. If I take my own fuel selector code and make a 3 position from it (its a 5 position originally) it stops working. I cant seem to get it right and I cant stand it..... WHAT in the WORLD!? Why is this so dang difficult...

Here is my latest. This was supposed to work for sure. I have studied and studied it. It should work! All it does it move the switch 'up' to point 50 from zero. It will not go to KF 25 (-25 M:Y position). I cant tell you how many LearJets I have compiled for a single left generator switch in 5 days.


Code:
<PartInfo>
        <Name>learjet24_gen_left</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                (L:SET_GEN_LEFT_FLAG, number) 0 ==
                if{ 1 (&gt;L:SET_GEN_LEFT_FLAG, number)
                (A:GENERAL ENG STARTER:1, bool) 0 ==
                (A:GENERAL ENG GENERATOR SWITCH:1, bool) 0 ==
                and
                if{ 0 (&gt;L:GEN_LEFT_SELECT_POS,number) }
                (A:GENERAL ENG STARTER:1, bool) 1 ==
                (A:GENERAL ENG GENERATOR SWITCH:1, bool) 0 ==
                and
                if{ 25 (&gt;L:GEN_LEFT_SELECT_POS,number) }
                (A:GENERAL ENG STARTER:1, bool) 0 ==
                (A:GENERAL ENG GENERATOR SWITCH:1, bool) 1 ==
                and
                if{ 50 (&gt;L:GEN_LEFT_SELECT_POS,number) }
                }
                els{
                (L:GEN_LEFT_SELECT_POS, Number)
                }
        </Code>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
              <TooltipText>
         Starter/Generator: %('Generator ON' 'Starter ON' 'OFF' 3 (A:GENERAL ENG STARTER:1, bool) (A:GENERAL ENG GENERATOR ACTIVE, bool) 2 * + case)             
              </TooltipText>
    <MouseFlags>LeftSingle+LeftRelease+LeftDrag+Wheel</MouseFlags>
    <CallbackCode>
      (M:Event) 'LeftSingle' scmp 0 ==
      if{
        (M:Y) (&gt;L:GEN_LEFT_SELECT_POS, Number)
      if{ 1 (&gt;L:XMLSND1,enum) }
        quit
      }
        (M:Event) 'LeftDrag' scmp 0 ==
      if{
        (M:Y) (L:GEN_LEFT_SELECT_POS,number) - 0.2 * (L:GEN_LEFT_SELECT_POS, Number) + -25 max 25 min (&gt;L:GEN_LEFT_SELECT_POS, Number)
        (M:Y) (&gt;L:GEN_LEFT_SELECT_POS, Number) }
      if{
        -5 5 (L:GEN_LEFT_SELECT_POS, Number) rng
        if{ 0 (&gt;L:GEN_LEFT_SELECT_POS, Number) } }
      if{
        6 25 (L:GEN_LEFT_SELECT_POS, Number) rng
        if{ 25 (&gt;L:GEN_LEFT_SELECT_POS, Number) }
            (L:GEN_LEFT_SELECT_POS, Number) 25 ==
            if{ (>K:TOGGLE_ALTERNATOR1) } }
      if{
        -6 -25 (L:GEN_LEFT_SELECT_POS, Number) rng
        if{ -25 (&gt;L:GEN_LEFT_SELECT_POS, Number) }
            (L:GEN_LEFT_SELECT_POS, Number) 25 ==
            if{ (>K:TOGGLE_STARTER1) } }
       (M:Event) 'LeftRelease' scmp 0 ==
      if{ 1 (&gt;L:XMLSND1,enum) }
      if{ (L:GEN_LEFT_SELECT_POS, Number) -25 ==
        if{ 0 (&gt;L:GEN_LEFT_SELECT_POS, Number) } }
        </CallbackCode>
        </MouseRect>
    </PartInfo>


And Tom, the ToolTip here is yours from another post, it doesn't work, but it might be P3D V2.1. 2.1 has also broken all of my MFD (GPS) screens in my fleet of payware. (spit).

Makes me want to take up kick boxing and go out at night and attack brick walls...
 
Bill, I understand your anger but you may be aware that making code without a full comprehension of what is being written has to be a tough work for sure.

Firts, let me tell you it is logical that the tooltip text wouldn't work as myself, a lazy guy nowadays, transcribed your code assuming the AVars were well written, which was a wrong assumption. Please check GENERAL ENGINE GENERATOR ACTIVE and add what is missing;) Besides, do not put a CR-LF between <TooltipText> and
Starter/Generator: phrase, as it could lead to troubles. Just write <TooltipText>Starter/Generator: ...etc.

Last and most important, you are confusing the Y scale for dragging as being the range of keyframes defined, when in fact it corresponds to the height, in pixels, of the mouse rectangle where drag takes place.
Remember then, Kf is a time var and (M:Y) is a position var.

So I recommend you stick to the example I posted a couple of messages above, and replace those 100, 30 and 40 values with proper ones from your mouse's area height, and only when you get it working make your own adaptations.

Tom
 
Ah sooo... Many thanks Tom. Knowing that tidbit about (M:Y) helps a lot.

you may be aware that making code without a full comprehension of what is being written has to be a tough work for sure.
Tom

You've got that right. It is terribly frustrating. But I am learning, though agonizingly slowly.

Would you mind me asking a battery of questions on this? Or am I wearing you out on questions.
 
I actually got one to animate! Not properly, but its animating from zero to 25 to 50 KF's! A little success after many days.

Now to see if I can make it animate with down-drag to 25KF and then updrag to zero and then to 50KF point. (Down from zero/neutral, then up past that to 50KF / up position).


Code:
<PartInfo>
        <Name>learjet24_gen_left</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                (L:LEFT_GEN_SET_FLAG, number) 0 ==
                if{ 1 (&gt;L:LEFT_GEN_SET_FLAG, number)

        (L:LEFT GEN SELECT_POS,number) 20 &lt;
                if{ 0 (&gt;L:LEFT GEN SELECT_POS,number) }

      21 40 (L:LEFT GEN SELECT_POS,number) rng
                if{ 25 (&gt;L:LEFT GEN SELECT_POS,number) }

        (L:LEFT GEN SELECT_POS,number) 41 &gt;
                if{ 50 (&gt;L:LEFT GEN SELECT_POS,number) }
                }

                els{
                (L:LEFT GEN SELECT_POS, Number)
                }
        </Code>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
    <MouseFlags>LeftSingle+LeftRelease+LeftDrag+Wheel</MouseFlags>
    <CallbackCode>
      (M:Event) 'LeftSingle' scmp 0 ==
      if{
        (M:Y) (&gt;L:LEFT GEN MOUSEPOS,number)
        quit
      }
     
      (M:Event) 'LeftDrag' scmp 0 ==
      if{
        (M:Y) (L:LEFT GEN MOUSEPOS,number) - 0.2 * (L:LEFT GEN SELECT_POS,number) + 0 max 75 min (&gt;L:LEFT GEN SELECT_POS,number)
        (M:Y) (&gt;L:LEFT GEN MOUSEPOS,number)
      }
     
      (M:Event) 'LeftRelease' scmp 0 ==
      if{
        (L:LEFT GEN SELECT_POS,number) 20 &lt;
        if{
        0 (&gt;L:LEFT GEN SELECT_POS,number)

        }
        21 45 (L:LEFT GEN SELECT_POS,number) rng
        if{
        25 (&gt;L:LEFT GEN SELECT_POS,number)

        }
        46 55 (L:LEFT GEN SELECT_POS,number) rng
        if{
        50 (&gt;L:LEFT GEN SELECT_POS,number)

        }

      }
        </CallbackCode>
        </MouseRect>
    </PartInfo>
 
Ok... Tried to change the code to a -25 - 0 - 25 KF system. Not working, but, I got a cool action that I could sure use if I could place it differently. It starts out at 'off' and when you mouse drag it down, it moves to down position, then when you go to move it upwards, it moves up, but smacks back down to down position (3 positions, up, down, middle).

What I 'want' is to make this drag down (only) to down position and it only stays if you hold it there, then release and it flips back up to off. Then you can drag it up to on position and back off again. So, when holding it down in start (down) position, it is running the jet starter, spooling up the turbine. LeftRelease at down position and the starter turns back off.


Code.....

Code:
    <CallbackCode>
      (M:Event) 'LeftSingle' scmp 0 ==
      if{
        (M:Y) (&gt;L:LEFT GEN MOUSEPOS,number)
        quit
      }
    
      (M:Event) 'LeftDrag' scmp 0 ==
      if{
        (M:Y) (L:LEFT GEN MOUSEPOS,number) - 0.2 * (L:LEFT GEN SELECT_POS,number) + -25 max 25 min (&gt;L:LEFT GEN SELECT_POS,number)
        (M:Y) (&gt;L:LEFT GEN MOUSEPOS,number) }
    
      (M:Event) 'LeftRelease' scmp 0 ==
      if{
        -5 5 (L:LEFT GEN SELECT_POS,number) rng
        if{
        0 (&gt;L:LEFT GEN SELECT_POS,number) }

        (L:LEFT GEN SELECT_POS,number) -6 &lt;
        if{
        25 (&gt;L:LEFT GEN SELECT_POS,number) }
        46 55 (L:LEFT GEN SELECT_POS,number) rng   <-- EDIT:  ooops.  line deleted

        (L:LEFT GEN SELECT_POS,number) 6 &lt;
        if{
        50 (&gt;L:LEFT GEN SELECT_POS,number) }
      }
        </CallbackCode>
 
Last edited:
A little closer... (oh man! )

This enables me to mouse drag the switch down, but will not return it to full zero KF (middle) position. But it will go to up position, but only from 25KF point. If only it could go from zero point directly to 50.

I wonder if having a 'set key' at 25KF point causes this to occur? Without the 25KF PT. though, it wouldn't know where 25 was, right? or am I wrong, would the system be able to auto-create its own point without needing and animation KF point?

CallbackCode so far;


Code:
    <CallbackCode>
      (M:Event) 'LeftSingle' scmp 0 ==
      if{
        (M:Y) (&gt;L:LEFT GEN MOUSEPOS,number)
        quit
      }
   
      (M:Event) 'LeftDrag' scmp 0 ==
      if{
        (M:Y) (L:LEFT GEN MOUSEPOS,number) - 0.2 * (L:LEFT GEN SELECT_POS,number) + -25 max 25 min (&gt;L:LEFT GEN SELECT_POS,number)
        (M:Y) (&gt;L:LEFT GEN MOUSEPOS,number)
      }
   
      (M:Event) 'LeftRelease' scmp 0 ==
      if{
        -9 9 (L:LEFT GEN SELECT_POS,number) rng
        if{
        0 (&gt;L:LEFT GEN SELECT_POS,number) }

        (L:LEFT GEN SELECT_POS,number) -10 &lt;
        if{
        25 (&gt;L:LEFT GEN SELECT_POS,number) }

        (L:LEFT GEN SELECT_POS,number) 10 &lt;    <--  EDIT:  Changed to &gt;
        if{
        50 (&gt;L:LEFT GEN SELECT_POS,number) }
      }
        </CallbackCode>
 
Last edited:
Ok, really close. Finding that mistake, the switch will now flip down, flip up, return to zero, but the return to zero from down position takes two very slow, small movements and usually it flips from down to up position, skipping past zero.

Now to figure out how to get it to flip back to zero from KF 25, and then to move from KF 0 to KF 50 straight away without going to KF 25, like a direct jump.

Outline;
Drag down and hold.............. starter begins to spool up
LeftRelease.......................... switch returns to zero, starter stops
Drag up............................... switch stays and turns on Generator (Alternator)
Drag down from KF 50........... Switch is in off mode, Generator off, starter off.

Im wondering how to get the switch to flip back to zero KF from 25KF?


(Hope you all do not mind me typing out all of my notes here. Helps me to write about it).
 
REALLY close....

I have the switch moving down to bottom from middle, and it bounces back when letting go. I increased the - 0.2 * in MOUSEPOS up to 1.0 * for better scaling of the switch movement.

I also made the zero KF zone a 'no settings' which is probably causing me not to be able to move from zero to the 50KF point.

But, it will not drag up to the top and stay up from middle position.

Code:
    <CallbackCode>
      (M:Event) 'LeftSingle' scmp 0 ==
      if{
        (M:Y) (&gt;L:LEFT GEN MOUSEPOS,number)
        quit
      }
    
      (M:Event) 'LeftDrag' scmp 0 ==
      if{
        (M:Y) (L:LEFT GEN MOUSEPOS,number) - 1 * (L:LEFT GEN SELECT_POS,number) + -25 max 25 min (&gt;L:LEFT GEN SELECT_POS,number)
        (M:Y) (&gt;L:LEFT GEN MOUSEPOS,number)
      }
    
      (M:Event) 'LeftRelease' scmp 0 ==
      if{
                  (L:LEFT GEN SELECT_POS,number)
        if{
        0 (&gt;L:LEFT GEN SELECT_POS,number)
        }

        (L:LEFT GEN SELECT_POS,number) -3 &lt;
        if{
        0 (&gt;L:LEFT GEN SELECT_POS,number)
        }

        (L:LEFT GEN SELECT_POS,number) 5 &gt;
        if{
        50 (&gt;L:LEFT GEN SELECT_POS,number)
        }
      }
        </CallbackCode>
 
Bill,

I understand your efforts to make the code work, but as I told you before, I strongly recommend that you stick to the example posted in message #7
Yes, I know that you have preferred to start from a similar code that is proven to work but, believe me, guessing here and there from that snippet, even though you could finally make it work, isn't a good line to follow. Notice that message #7 contains a simple and clean approach, which is what you need in this case.
Just by comparing your latest <Animation> section and the same posted in #7 should make you think about it.

Now, the next thing I'd like to know is the values returned by (M:Y) when dragging the cursor over the mouse rectangle. So please add this line:

Code:
(M:Event) 'LeftDrag' scmp 0 ==
if{ (M:Y) (>L:MousePixel,number)
......
....

Then in another gauge than can display data, check the values returned by (L:MousePixel,number) and let me know what is shown from the top to the botton of the rectangle. With this numbers I can update message #7 and give you a fully optimized and working code.

Tom
 
Hey Tom,

Man, I have no idea how to create a gauge that reads mouse input. Remember, you and the gauge gurus do this all the time. Im very underqualified in the gauge code field. My knowledge is basic. :(

Also, I just couldn't get yours to function. It would move to the down position, but that's it. Also, the s0 and L0 really threw me off. There are two versions of save data points, which I do not fully understand in how far it can save in a stack.

man.... If only there were classes on this.
 
Back
Top