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

XML Animation issues

Messages
549
Country
nicaragua
Hi!
I have this doubt that I think you can awnser me: What kind of code do I need to play the animation just by pressing a button. Kinda like opening the door by clicking on the handle. I can only make those kinds of animations with dragging parts, but I wanted all to work automaticly just by pressing...
Does it have to by like a visibility code?
Thanks!

BTW: I'm using the Fs2004 SDK!

Ricardo
 
It's simple, really. There are many examples in the MakeMDL.parts.xml file...

Here though are two custom animations that are specifically for "click on the handle and the door opens" that you asked about. Change the partnames for your own use of course!

The first example script is for a main door. The second example script shows how to modify the code for exit_2. You can have up to 4 door animations with this method.

Code:
<!--  DA42 CUSTOM ANIMATIONS -->
   <part>
    <name>da42_canopy_latch_knob</name>
        <animation>
           <Parameter>
             <Sim>
               <Variable>EXIT OPEN:0</Variable>
               <Units>percent</Units>
             </Sim>
           </Parameter>
        </animation>
	<mouserect>
		<cursor>Hand</cursor>
		<tooltip_text>Canopy Open</tooltip_text>
		<event_id>TOGGLE_AIRCRAFT_EXIT</event_id> 
	</mouserect>
   </part>
   <part>
    <name>da42_side_latch_knob</name>
        <animation>
           <Parameter>
             <Sim>
               <Variable>EXIT OPEN:1</Variable>
               <Units>percent</Units>
             </Sim>
           </Parameter>
        </animation>
	<mouserect>
		<cursor>Hand</cursor>
		<tooltip_text>Aft Pax Door</tooltip_text>
		<callback_code>
			(>K:TOGGLE_AIRCRAFT_EXIT,bool)
			(>K:SELECT_2,bool)
		</callback_code>
	</mouserect>
   </part>
 
Thanks! It worked! Is it ok if I use some other variables?

Of course. Use the variables that make sense for whatever it is you want to do. Consider the examples I gave as "patterns" you can follow... ;)

If you use a "stock variable" and "key_event" then use the <event_id> format:
<event_id>TOGGLE_AIRCRAFT_EXIT</event_id>

If you use a "custom variable" and a "custom key_event" then use the <callback_code> format:
Code:
		<callback_code>
			(L:LeftStowSwitch, bool) ! (>L:LeftStowSwitch, bool)
		</callback_code>
 
Last edited:
Sorry, I can't seem to make a costum animation: Here's the code:
Code:
<part>
<name>HUD_switch</name>
      <animation>
           <parameter>
                 <sim>
                       <variable>HUDmove</variable>
                       <units>percent</units>
                 </sim>
           </parameter>
     </animation>

<mouserect>
         <cursor>hand</cursor>
         <tooltip_text>Hide/Show HUD</tooltip_text>
         <callback_code>
               (L:Hudmove,bool) ! (&gt;L:Hudmove,bool)
         </callback_code>
      </mouserect>
</part>
 
<sim> only works with stock variable names.

<code> is used for custom variable names.
Code:
<part>
      <name>HUD_switch</name>
      <animation>
           <parameter>
                 <code>
                       (L:Hudmove,bool)
                 </code>
           </parameter>
     </animation>

      <mouserect>
         <cursor>hand</cursor>
         <tooltip_text>Hide/Show HUD</tooltip_text>
         <callback_code>
               (L:Hudmove,bool) ! (&gt;L:Hudmove,bool)
         </callback_code>
      </mouserect>
</part>
 
Back
Top