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

Gauge code question

Messages
10,158
Country
us-arizona
Hey guys,


I have some code I am trying to put into FSX Gmax code from FS9 XML 2D switch gauge code.

Here is what I am trying to do.


These are two switches in regular FS9 gauge code that operate selections.

Code:
   <Area Left="65" Right="115" Top="40" Bottom="120">
      <Visible> 1 </Visible>
        <Tooltip>Music Player Power</Tooltip>
         <Cursor Type="Hand"/>
        <Click Kind="LeftSingle + RightSingle">
          (M:Event) 'LeftSingle' scmp 0 ==  
             if{ (L:Song Power,enum) 1 == if{ 0 (&gt;L:Song Power,enum) 1 (&gt;L:XMLStopSND,enum) } els{ 1 (&gt;L:Song Power,enum) } 
        </Click>
      </Area>

// LH STEP SWITCH
<Area Name="STEP Switch Left" Left="61" Top="144" Width="96" Height="60">
  <Tooltip>STEP Switch Left ( %((L:Song Index,enum))%!d of @NUM_SONGS)%</Tooltip>
  <Cursor Type="Hand"/>
   <Click Kind="LeftSingle+Leave" Repeat="No">
     (M:Event) 'LeftSingle' scmp 0 == 
     if{ 1 (&gt;L:STEPSWITCH_POS, enum) (L:Song Index,enum) 1 == if{ @NUM_SONGS (&gt;L:Song Index,enum) } els{ (L:Song Index,enum) 1 - @NUM_SONGS min 1 max (&gt;L:Song Index,enum) } 1 (&gt;L:Toggle active,bool) }
   (M:Event) 'Leave' scmp 0 == if{ 2 (&gt;L:STEPSWITCH_POS, enum) }
   </Click>
 </Area>


What I need is to integrate 2 more strings into their commands for each of the two switches. In FSX, the VC animated buttons will be two components, while in the 2D switch format, they presently appear as one. Still though, as you can see above, the existing code is for two seperate click zones and two seperate commands, so no big deal there.


Here is what I must integrate;

Button A;

(L:LHC XM Radio Switch,number) ! (&gt;L:LHC XM Radio Switch,number)
1 (&gt;L:XMLSND7,enum)

Button B;

(L:LHC XM Radio Song Selector,number) ! (&gt;L:LHC XM Radio Song Selector,number)
1 (&gt;L:XMLSND7,enum)


Here is a 'try' at mixing and forming the code for the CallbackCode section;

1ST BUTTON:


<CallbackCode>(L:LHC XM Radio Switch,number) ! (&gt;L:LHC XM Radio Switch,number)
(M:Event) 'LeftSingle' scmp 0 ==
if{ (L:Song Power,enum) 1 == if{ 0 (&gt;L:Song Power,enum) 1 (&gt;L:XMLStopSND,enum) } els{ 1 (&gt;L:Song Power,enum) }
1 (&gt;L:XMLSND7,enum)
</CallbackCode>


2ND BUTTON:


<CallbackCode>(L:LHC XM Radio Song Selector,number) ! (&gt;L:LHC XM Radio Song Selector,number)
'LeftSingle' scmp 0 ==
if{ (L:Song Power,enum) 1 == if{ 0 (&gt;L:Song Power,enum) 1 (&gt;L:XMLStopSND,enum) } els{ 1 (&gt;L:Song Power,enum) }
1 (&gt;L:XMLSND7,enum)
</CallbackCode>


So far, I have been able to at least get the 'click sound' and animation to work on the first VC Gmax switch, but the second is not working. The first also will only click on the first try, but on turning it off, the click does not occur. The second switch does not function.

The code works brilliant and functions properly for 2D gauge switch code.


I have looked through various stacks in the FSX gauge code and wasnt able to find something similar.


Any idea's? Many thanks for any thoughts on this.



Bill
 
Ok.. Some progress.

I tried this, adding M:Event sections to each of the three sections of code;


First Switch;

<CallbackCode>
(M:Event)
(L:LHC XM Radio Switch,number) ! (&gt;L:LHC XM Radio Switch,number)
(M:Event)
1 (&gt;L:XMLSND7,enum)
(M:Event)
'LeftSingle' scmp 0 == if{ (L:Song Power,enum) 1 == if{ 0 (&gt;L:Song Power,enum) 1 (&gt;L:XMLStopSND,enum) } els{ 1

(&gt;L:Song Power,enum) }
</CallbackCode>


Second Switch;


<CallbackCode>
(M:Event)
(L:LHC XM Radio Song Selector,number) ! (&gt;L:LHC XM Radio Song Selector,number)
(M:Event)
1 (&gt;L:XMLSND7,enum)
(M:Event)
'LeftSingle' scmp 0 ==
if{ (L:Song Power,enum) 1 == if{ 0 (&gt;L:Song Power,enum) 1 (&gt;L:XMLStopSND,enum) } els{ 1 (&gt;L:Song Power,enum) }
</CallbackCode>



This is allowing them to both 'Click' as well as Animate. Switch two is not causing the sounds to play.


Oh.. What they do; Short string causes switch click sound. Second string is for animation to occur. Large section of gauge code is for a music system. Switch one is the on/off. Switch two is a rocker switch. I still need to figure out how to get the switch to go from point A, to point B, and return to point A in one click. But getting the music playing is job one for right now. This will have 7 music selections of which the 'rocker' switch will take you through each of the selections in order.


Bill
 
Last edited:
Back
Top