- Messages
- 1,451
- Country

Hello lads
I am wondering if you can lend me a hand with a custom animation. I spend three weeks working with this problem before asking for help. Belive me, I've read all I could in this regard and what have been said on several posts.
Well, there we go with the idea:
If I am correct, this code is for a part that behaves like a button which toggles "on/off" . The variable controlling it, came from Don Khun's Garmin 330GTX. I've use a similiar code with other 3d items and it worked:
Now, he wrote in his Garmin's code a logic which toggles 5 functions using a single function button:
After a lot of time trying to do it, I think I grasp the key idea here:
http://www.fsdeveloper.com/forum/threads/one-switch-3-commands-one-at-a-time.435010/#post-720933
My goal is to built a 3D function button that cycles itself 5 steps; it is a mixed idea combining the first code and the one from Delivery Guy's code in the last thread. L:330gtx_func_swap,bool will be changing its state on each click; so I need to link in some way the variable L:330gtx_func_inc to initiate a loop from 0 to 4 that swap the functions in the nested 'if' conditions. My version to that is this:
Nevertheless, I am not able to make this work. If I undestood well, the line
(L:330gtx_func_inc,enum) ++ 4 % (>L:330gtx_func_inc,enum) will construct a counter up from 0 to 4 and start all over again.
Errata:
To understand the loop code (newbies like me), please read:
http://www.fsdeveloper.com/wiki/index.php?title=XML:_Increment_Variable_w/Modulo_Reset
I guess we need to thank to Fr. Leaming for this explanation.
Any help would be very appreciated.
In advance,
Thank you.
Sergio.
I am wondering if you can lend me a hand with a custom animation. I spend three weeks working with this problem before asking for help. Belive me, I've read all I could in this regard and what have been said on several posts.
Well, there we go with the idea:
If I am correct, this code is for a part that behaves like a button which toggles "on/off" . The variable controlling it, came from Don Khun's Garmin 330GTX. I've use a similiar code with other 3d items and it worked:
HTML:
<part>
<name>toggle_garmin330gtx_ssbutt</name>
<animation>
<parameter>
<code>
(L:SS,bool) 100 *
</code>
</parameter>
</animation>
<mouserect>
<cursor>Hand</cursor>
<tooltip_text>Start/Stop</tooltip_text>
<callback_code>
(L:SS,bool) ! (>L:SS,bool)
</callback_code>
</mouserect>
</part>
Now, he wrote in his Garmin's code a logic which toggles 5 functions using a single function button:
HTML:
<Element>
<Position X="412" Y="23"/>
<Select>
<Value>(L:PrAlt,bool)</Value>
<Case Value="0">
<Image Name="Funcbutt_out.bmp" ImageSizes="30,20"/>
</Case>
<Case Value="1">
<Image Name="Funcbutt_in.bmp" ImageSizes="30,20"/>
</Case>
</Select>
</Element>
<Element>
<Position X="412" Y="23"/>
<Select>
<Value>(L:Flt,bool)</Value>
<Case Value="0">
<Image Name="Funcbutt_out.bmp" ImageSizes="30,20"/>
</Case>
<Case Value="1">
<Image Name="Funcbutt_in.bmp" ImageSizes="30,20"/>
</Case>
</Select>
</Element>
<Element>
<Position X="412" Y="23"/>
<Select>
<Value>(L:DAlt,bool)</Value>
<Case Value="0">
<Image Name="Funcbutt_out.bmp" ImageSizes="30,20"/>
</Case>
<Case Value="1">
<Image Name="Funcbutt_in.bmp" ImageSizes="30,20"/>
</Case>
</Select>
</Element>
<Element>
<Position X="412" Y="23"/>
<Select>
<Value>(L:CUp,bool)</Value>
<Case Value="0">
<Image Name="Funcbutt_out.bmp" ImageSizes="30,20"/>
</Case>
<Case Value="1">
<Image Name="Funcbutt_in.bmp" ImageSizes="30,20"/>
</Case>
</Select>
</Element>
<Element>
<Position X="412" Y="23"/>
<Select>
<Value>(L:AltM,bool)</Value>
<Case Value="0">
<Image Name="Funcbutt_out.bmp" ImageSizes="30,20"/>
</Case>
<Case Value="1">
<Image Name="Funcbutt_in.bmp" ImageSizes="30,20"/>
</Case>
</Select>
</Element>
After a lot of time trying to do it, I think I grasp the key idea here:
http://www.fsdeveloper.com/forum/threads/one-switch-3-commands-one-at-a-time.435010/#post-720933
My goal is to built a 3D function button that cycles itself 5 steps; it is a mixed idea combining the first code and the one from Delivery Guy's code in the last thread. L:330gtx_func_swap,bool will be changing its state on each click; so I need to link in some way the variable L:330gtx_func_inc to initiate a loop from 0 to 4 that swap the functions in the nested 'if' conditions. My version to that is this:
HTML:
<part>
<name>toggle_garmin330gtx_funcbutt</name>
<animation>
<parameter>
<code>
(L:330gtx_func_swap,bool) 100 *
</code>
</parameter>
</animation>
<mouserect>
<cursor>Hand</cursor>
<tooltip_text>FUNC</tooltip_text>
<callback_code>
(L:330gtx_func_swap,bool) ! (>L:330gtx_func_swap,bool)
<!-- Counter up in a cycle??? -->
(L:330gtx_func_inc,enum) ++ 4 % (>L:330gtx_func_inc,enum)
(L:330gtx_func_inc,enum, enum) 0 ==
if{ (L:PrAlt,bool) ! (>L:PrAlt,bool) }
(L:330gtx_func_inc,enum, enum) 1 ==
if{ (L:Flt,bool) ! (>L:Flt,bool) }
(L:330gtx_func_inc,enum, enum) 2 ==
if{ (L:DAlt,bool) ! (>L:DAlt,bool) }
(L:330gtx_func_inc,enum, enum) 3 ==
if{ (L:CUp,bool) ! (>L:CUp,bool) }
(L:330gtx_func_inc,enum, enum) 4 ==
if{ (L:AltM,bool) ! (>L:AltM,bool) }
</callback_code>
</mouserect>
</part>
Nevertheless, I am not able to make this work. If I undestood well, the line
(L:330gtx_func_inc,enum) ++ 4 % (>L:330gtx_func_inc,enum) will construct a counter up from 0 to 4 and start all over again.
Errata:
To understand the loop code (newbies like me), please read:
http://www.fsdeveloper.com/wiki/index.php?title=XML:_Increment_Variable_w/Modulo_Reset
I guess we need to thank to Fr. Leaming for this explanation.
Any help would be very appreciated.
In advance,
Thank you.
Sergio.
Last edited:





