Hey FSNewbie,
Are you saying you havent written code before for a FSX plane? or that you cannot seem to get the code working for the plane...?
Basically you want to create a 'custom' L var and then set its animation speed. You may need two, one being the actual part animation code, and then a switch that 'starts' the code.
If you are a newbie to writing code, basically you have a main command string buried in a block of code. This command would be something like;
L:FIRE NUBE MISSLE
Which would then be contained in a sub-string;
(L:FIRE NUBE MISSLE, bool) (bool means something similar to 'run' ).
Here is a quick animation block that will run both a switch and a part. Mind you the switch will run at the same speed as the part will, so if you want to make the switch animate, and at a different speed, you would then create (copy/paste) a second block of code, and change key points in the block, making it different from the first, but keep the primary code string; (L:FIRE NUBE MISSLE, bool) which will cause the first one to work also.
Here is the code for testing it with.
Code:
<PartInfo>
<Name>newbie_fire_missle</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>(L:FIRE NUBE MISSLE, bool) 100 *</Code>
<Lag>10</Lag>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Fire Missle One</TooltipText>
<CallbackCode>
(L:FIRE NUBE MISSLE,bool) ! (>L:FIRE NUBE MISSLE,bool)
</CallbackCode>
</MouseRect>
</PartInfo>
This is set to a very slow speed, so you may wish to increase the Lag time. note that ToolTip is what the mouseover will say. Note two, the Callback code is the 'run, stop run' code command.
There are tons of different ways to write code. This is only an example 'if' you are a newbie to code writing. This will get you going and can experiment with how its done. You may wish to do something more exotic which would have timers and things, a auto-reset calculator based on a set time element where the missle comes back and reattaches itself, etc, etc. Thats up to you and I have no idea how to write exotic code. (I hire people to do that for me now).
In case you do not know where the code is put in at, you would enter it into the 'elaborate' and massive 'modeldef.xml' code sheet, which you open with Windows Notepad and edit as you need. This is located in your FSX SDK/Evironment Kit/Model SDK/Bin folder. Make a backup copy before carrying out work on it so if you mess up your main code sheet, you can go to your backup and start over again. (I date my backups, and have perhaps 20 of them so far just in case). Note that you must also create a GUID string at the top of the 'modeldef.xml' code sheet. Pick up the GUID generator and make a new GUID for your code and copy/paste another string with a similar animation and make that your new GUID string. Here is an example;
<Animation name="lhc_park_aircraft_mode_switch" guid="456BD238-20FD-48ff-9CD7-31913FF44AB2" length="100" type="Sim" typeParam2="lhc_park_aircraft_mode_switch" typeParam="AutoPlay" />
You would switch out the 'names' sections to the name on your new missle code, the actual part code itself.
<--- insert belly ache here Why we need a sophisticated serial number and renaming of names several times in different locations, I'll never know.... why oh why... (smacks head on desk)
I hope that helps and puts some light on the subject for you.
Bill