- Messages
- 10,163
- Country

Hey guys,
Can someone please explain to me the basics of how this gauge operates? I have been staring at it for 2 hours and thought its time to ask a professional how it actually works.
Here is the ModelDef code (its a fuel selector, custom done) and below this will be my questions about it;
Question one: In the first part, in the <Code> section, why does this need to occur? Is this starting the part to zero point (animation position) when the plane boots up?
<Code>
(L:SET_FLAG, number) 0 ==
if{ 1 (>L:SET_FLAG, number)
////////////////////////////////////////////////////////////////////////////////////////////////////
Question two: In the top part, in the <Code> section, the animations are given. I have no idea how this is working. I take it that 1, 0, 30, 150, and 90 are the movements which coincides with scale of 150 KF's. Is it saying that if fuel tank selector is at '16', then move to KF position 150?
////////////////////////////////////////////////////////////////////////////////////////////////////
Question three: (More like verification), I take it that (M:Y) means Y axis mouse movement.
////////////////////////////////////////////////////////////////////////////////////////////////////
Question four: What is being stated here? One is mouse clicking and its stating no number amount and then terminates. What is its cause?
(M:Event) 'LeftSingle' scmp 0 ==
if{
(M:Y) (>L:MOUSEPOS,number)
quit
}
////////////////////////////////////////////////////////////////////////////////////////////////////
Question five: The last portion of the Mouse section shows ranges and numbers. Those must be the key frames? Or are they (M:Y) movements? I note that these only occur with LeftRelease actions. They also have fuel selector commands, but how does the switch know what point to move to?
(M:Event) 'LeftRelease' scmp 0 ==
if{
(L:SELECT_POS,number) 20 <
if{
0 (>L:SELECT_POS,number)
16 (>K:FUEL_SELECTOR_SET)
}
21 45 (L:SELECT_POS,number) rng
if{
25 (>L:SELECT_POS,number)
2 (>K:FUEL_SELECTOR_SET)
}
46 55 (L:SELECT_POS,number) rng
if{
50 (>L:SELECT_POS,number)
3 (>K:FUEL_SELECTOR_SET)
}
70 75 (L:SELECT_POS,number) rng
if{
75 (>L:SELECT_POS,number)
0 (>K:FUEL_SELECTOR_SET)
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
Question six: Back to <Code> (animation), is this stating that if the fuel enum is at 16, then move to KF 150? (I think I can answer this one, as I have been writing these questions, I think I am figuring out a few of the things that make this function, answer being yes, if fuel selector 16 is active, then move this part to KF 150).
(A:FUEL TANK SELECTOR:1, enum) 16 ==
if{ 150 (>L:SELECT_POS,number) }
Sorry for all the questions. This one has always mesmerized me and I have more uses for something like this but have no idea how it basically all works. For instance, how does it know to move the certain amounts of mouse travel scaled with the actual switch? For instance, if this was a huge lever, how would I make the mouse travel 'more' to compensate the giant lever being worked? ( <-- Question seven, sigh..... )
Example, is this stating how many pixels the mouse travels? 0 thru 75? And what is -0.2 * for?
(M:Y) (L:MOUSEPOS,number) - 0.2 * (L:SELECT_POS,number) + 0 max 75 min (>L:SELECT_POS,number)
(M:Y) (>L:MOUSEPOS,number)
Can someone please explain to me the basics of how this gauge operates? I have been staring at it for 2 hours and thought its time to ask a professional how it actually works.
Here is the ModelDef code (its a fuel selector, custom done) and below this will be my questions about it;
Code:
<PartInfo>
<Name>switch_fuel_selector_da40</Name>
<AnimLength>150</AnimLength>
<Animation>
<Parameter>
<Code>
(L:SET_FLAG, number) 0 ==
if{ 1 (>L:SET_FLAG, number)
(A:FUEL TANK SELECTOR:1, enum) 0 ==
if{ 0 (>L:SELECT_POS,number) }
(A:FUEL TANK SELECTOR:1, enum) 2 ==
if{ 30 (>L:SELECT_POS,number) }
(A:FUEL TANK SELECTOR:1, enum) 16 ==
if{ 150 (>L:SELECT_POS,number) }
(A:FUEL TANK SELECTOR:1, enum) 3 ==
if{ 90 (>L:SELECT_POS,number) }
}
els{
(L:SELECT_POS, Number)
}
</Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<HelpID>HELPID_GAUGE_FUEL_SELECTOR</HelpID>
<TooltipID>TOOLTIPTEXT_FUEL_SELECTOR</TooltipID>
<MouseFlags>LeftSingle+LeftRelease+LeftDrag+Wheel</MouseFlags>
<CallbackCode>
(M:Event) 'LeftSingle' scmp 0 ==
if{
(M:Y) (>L:MOUSEPOS,number)
quit
}
(M:Event) 'LeftDrag' scmp 0 ==
if{
(M:Y) (L:MOUSEPOS,number) - 0.2 * (L:SELECT_POS,number) + 0 max 75 min (>L:SELECT_POS,number)
(M:Y) (>L:MOUSEPOS,number)
}
(M:Event) 'LeftRelease' scmp 0 ==
if{
(L:SELECT_POS,number) 20 <
if{
0 (>L:SELECT_POS,number)
16 (>K:FUEL_SELECTOR_SET)
}
21 45 (L:SELECT_POS,number) rng
if{
25 (>L:SELECT_POS,number)
2 (>K:FUEL_SELECTOR_SET)
}
46 55 (L:SELECT_POS,number) rng
if{
50 (>L:SELECT_POS,number)
3 (>K:FUEL_SELECTOR_SET)
}
70 75 (L:SELECT_POS,number) rng
if{
75 (>L:SELECT_POS,number)
0 (>K:FUEL_SELECTOR_SET)
}
}
</CallbackCode>
</MouseRect>
</PartInfo>
Question one: In the first part, in the <Code> section, why does this need to occur? Is this starting the part to zero point (animation position) when the plane boots up?
<Code>
(L:SET_FLAG, number) 0 ==
if{ 1 (>L:SET_FLAG, number)
////////////////////////////////////////////////////////////////////////////////////////////////////
Question two: In the top part, in the <Code> section, the animations are given. I have no idea how this is working. I take it that 1, 0, 30, 150, and 90 are the movements which coincides with scale of 150 KF's. Is it saying that if fuel tank selector is at '16', then move to KF position 150?
Code:
<Code>
(L:SET_FLAG, number) 0 ==
if{ 1 (>L:SET_FLAG, number)
(A:FUEL TANK SELECTOR:1, enum) 0 ==
if{ 0 (>L:SELECT_POS,number) }
(A:FUEL TANK SELECTOR:1, enum) 2 ==
if{ 30 (>L:SELECT_POS,number) }
(A:FUEL TANK SELECTOR:1, enum) 16 ==
if{ 150 (>L:SELECT_POS,number) }
(A:FUEL TANK SELECTOR:1, enum) 3 ==
if{ 90 (>L:SELECT_POS,number) }
}
els{
(L:SELECT_POS, Number)
}
</Code>
////////////////////////////////////////////////////////////////////////////////////////////////////
Question three: (More like verification), I take it that (M:Y) means Y axis mouse movement.
////////////////////////////////////////////////////////////////////////////////////////////////////
Question four: What is being stated here? One is mouse clicking and its stating no number amount and then terminates. What is its cause?
(M:Event) 'LeftSingle' scmp 0 ==
if{
(M:Y) (>L:MOUSEPOS,number)
quit
}
////////////////////////////////////////////////////////////////////////////////////////////////////
Question five: The last portion of the Mouse section shows ranges and numbers. Those must be the key frames? Or are they (M:Y) movements? I note that these only occur with LeftRelease actions. They also have fuel selector commands, but how does the switch know what point to move to?
(M:Event) 'LeftRelease' scmp 0 ==
if{
(L:SELECT_POS,number) 20 <
if{
0 (>L:SELECT_POS,number)
16 (>K:FUEL_SELECTOR_SET)
}
21 45 (L:SELECT_POS,number) rng
if{
25 (>L:SELECT_POS,number)
2 (>K:FUEL_SELECTOR_SET)
}
46 55 (L:SELECT_POS,number) rng
if{
50 (>L:SELECT_POS,number)
3 (>K:FUEL_SELECTOR_SET)
}
70 75 (L:SELECT_POS,number) rng
if{
75 (>L:SELECT_POS,number)
0 (>K:FUEL_SELECTOR_SET)
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
Question six: Back to <Code> (animation), is this stating that if the fuel enum is at 16, then move to KF 150? (I think I can answer this one, as I have been writing these questions, I think I am figuring out a few of the things that make this function, answer being yes, if fuel selector 16 is active, then move this part to KF 150).
(A:FUEL TANK SELECTOR:1, enum) 16 ==
if{ 150 (>L:SELECT_POS,number) }
Sorry for all the questions. This one has always mesmerized me and I have more uses for something like this but have no idea how it basically all works. For instance, how does it know to move the certain amounts of mouse travel scaled with the actual switch? For instance, if this was a huge lever, how would I make the mouse travel 'more' to compensate the giant lever being worked? ( <-- Question seven, sigh..... )
Example, is this stating how many pixels the mouse travels? 0 thru 75? And what is -0.2 * for?
(M:Y) (L:MOUSEPOS,number) - 0.2 * (L:SELECT_POS,number) + 0 max 75 min (>L:SELECT_POS,number)
(M:Y) (>L:MOUSEPOS,number)
Last edited:
