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

FS2004 Custom toggle switch

Messages
246
Country
southafrica
This will be my first attempt on making a gauge - well a toggle switch.
After a few trial and errors on making my Heli optics turret to do what I want based on conditions, I decided to try and make a custom switch. So I need to do this basically:
Create a toggle switch, that when toggled on or off, it rotate my heli turret to the open position and close position.

My part name in Gmax is Gun_Turret

1)How do I create that custom gauge? (I have FS Panel Studio)
2) How do I write my makemdl.xml file so that the animation is based on that gauge?

Any help or link in the right direction will be appreciated

Cheers,

Jakes

I model for FS2004 in Gmax
 
This is for your model.xml
Create your animation 100 for the turret and keep the name Gun_Turret
Code:
  <part_info>
    <name>Gun_Turret</name>
    <animation>
      <parameter>
        <code>(L:turret, bool) 100*</code>
      <lag>50</lag>
      </parameter>
    </animation>
  </part_info>


here is the gauge
Code:
<Gauge Name="Gun_Turret" Version="1.0">
   <Element>
	<Select>
	   <Value>(L:turret, bool)</Value>
	   <Case Value="0">
		<Image Name="switch_off.bmp" />
	   </Case>
	   <Case Value="1">
		<Image Name="switch_on.bmp" />
	   </Case>
	</Select>
   </Element>
   <Mouse>
	<Tooltip>Gun_Turret_Switch</Tooltip>
	<Cursor Type="Hand"/>
   <Click>(L:turret, bool) ! (&gt;L:turret, bool)</Click>
   </Mouse>
</Gauge>

DG:D
 
Thank you very much for the help and quick response. Looks like I was somehow on the right track :D
However, the animation is not working 100% in the sim. The turret rotate 180deg from key 0 to key 100 in gmax but only a degree or so in FS

any idea why? I have removed the 100* from the makemdl.xml code also to see if it was causing the error, but still doing the same.

See the video link for more clarity

http://www.youtube.com/watch?v=BhfBUX-LyMU

Thanks,

Jakes
 
Try this. I think the gauge needs an animation length. I usually make the switch 3d and can write you a code for that. Then you can just not us a gauge at all. So try the second code if the gauge fails.

Code:
<Gauge Name="Gun_Turret" Version="1.0">
   <Element>
	<Select>
	   <Value>(L:turret, bool) [COLOR="Red"]100*[/COLOR] </Value>
	   <Case Value="0">
		<Image Name="switch_off.bmp" />
	   </Case>
	   <Case Value="1">
		<Image Name="switch_on.bmp" />
	   </Case>
	</Select>
   </Element>
   <Mouse>
	<Tooltip>Gun_Turret_Switch</Tooltip>
	<Cursor Type="Hand"/>
   <Click>(L:turret, bool) ! (&gt;L:turret, bool)</Click>
   </Mouse>
</Gauge>

Custom switch: Name your turret Gun_Turret_01 and the switch Gun_Turret_02
Code:
  <part_info>
    <name>Gun_Turret</name>
    <animation>
      <parameter>
        <code>(L:turret, bool) 100*</code>
      <lag>120</lag>
      </parameter>
    </animation>
  <mouse_rect>
    <cursor>Hand</cursor>
    <tooltip_text>Gun_Turret_Switch</tooltip_text> 
    <callback_code>
		(L:turret, bool) ! (&gt;L:turret, bool) 
    </callback_code>    
  </mouse_rect>
  </part_info>
This was converted from fsx, so check for mistakes or _ scores.

DG:eek:
 
Last edited:
Thank you for the help!. Adding the 100* to the gauge did not work. still doing the same. The idea of adding the switch to the VC is a great one, but I would like to have all teh features in the 2d panel available as well... or am I asking too much?

I also added <AnimLength>100</AnimLength> to the makemdl/xml code, but with no luck. :(
 
I also added <AnimLength>100</AnimLength> to the makemdl/xml code, but with no luck.

Jakes

Jakes,

That is a FSX command string. Here is the callouts for a typical FS9 custom Gmax animation;



Code:
<part>
   <name>ave_gearcrank_switch</name>
      <animation>
	<parameter>
	  <code>(L:AVEauxGEARcrankANIM, bool) 100 * </code>
 	  <lag>150</lag>
	</parameter>
      </animation>
   <mouserect>
	<cursor>Hand</cursor>
   <tooltip_text>Crank Down Landing Gear</tooltip_text>
   <callback_code>
               (L:AVEauxGEARcrankANIM, bool) ! (>L:AVEauxGEARcrankANIM, bool)
               1 (&gt;L:XMLSND73,enum)
   </callback_code>
   </mouserect>
</part>


Unstaggered version;

<part>
<name>ave_gearcrank_switch</name>
<animation>
<parameter>
<code>(L:AVEauxGEARcrankANIM, bool) 100 * </code>
<lag>150</lag>
</parameter>
</animation>
<mouserect>
<cursor>Hand</cursor>
<tooltip_text>Crank Down Landing Gear</tooltip_text>
<callback_code>
(L:AVEauxGEARcrankANIM, bool) ! (>L:AVEauxGEARcrankANIM, bool)
1 (&gt;L:XMLSND73,enum)
4 (>K:GEAR_PUMP)
</callback_code>
</mouserect>
</part>


Note, no capitals, and use of underscores. Animation is just <animation> . Also note the space between 100 and *.

You can trade out the L:var's for your own and it should work fine. Fill in the part name and tooltip as well.

To me, its a shame that FSX didnt carry on with the same XML that it always had. Things like this wouldnt be happening. Oh well. I dont mean to gripe, my apologies.


Nice work DG. Youre awesome man.
 
Thank you for the help!. Adding the 100* to the gauge did not work. still doing the same. (

The problem is one of S P A C I N G...

Code:
<code>(L:turret, bool) 100 *</code>

There MUST be a blank space between the number (100) and the asterisk (*)...
 
I was thinking that the * needed a space. I forgot. yep that's it. Bill and Bill just confirmed that!!!
I also added <AnimLength>100</AnimLength> to the makemdl/xml code, but with no luck.
Adding animation length is for fsx only.

Code:
  <part_info>
    <name>Gun_Turret</name>
    <animation>
      <parameter>
        <code>(L:turret, bool) 100 *</code>
      <lag>120</lag>
      </parameter>
    </animation>
  <mouserect>
    <cursor>Hand</cursor>
    <tooltip_text>Gun_Turret_Switch</tooltip_text> 
    <callback_code>
		(L:turret, bool) ! (&gt;L:turret, bool) 
    </callback_code>    
  </mouserect>
  </part_info>
Now it should work. DG:confused:
 
Last edited:
Wow, that space did the trick.

So here is my working code:

The MakeMDL.xml:
Code:
	<part> 
		<name>Gun_Optics</name>
         	<animation>
			  <parameter>
				<code>
(L:turret, number) 100 * 
				</code>
				<lag>50</lag>
			  </parameter>
			</animation>
		</part>

The gauge XML:
Code:
<Gauge Name="Gun_Optics" Version="1.0">
   <Element>
      <Select>
         <Value>(L:turret, number) 100 * </Value>
         <Case Value="0">
            <Image Name="switch_off.bmp"/>
         </Case>
         <Case Value="1">
            <Image Name="switch_on.bmp"/>
         </Case>
      </Select>
   </Element>
   <Mouse>
      <Tooltip>Gun Turret Switch</Tooltip>
      <Cursor Type="Hand"/>
      <Click>(L:turret, bool) ! (&gt;L:turret, bool)</Click>
   </Mouse>
</Gauge>

Thank you all for your valued input!
 
Back
Top