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

Modifing a switch into a button, Help please

Messages
19
Hi

I need some help on editing some gauges, let me start by saying this is for personal use, for a panel im creating for myself, the project is a panel for the Airbus Aircraft... anyways what im trying to do its to implement Paul Scarrat 737ng panel into my panel but there are some things that i need help, because his XML code are done for switches and im trying to change them to a on/off buttons but i dont quiet understand the lines..... like i said before is for personal enjoyment it wont be release ( i dont like stealing work from others)

And Example that I wanna make here....

<Element>
<Visible>(A:Circuit general panel on, bool)</Visible>
<Select>
<Value>(L:APU SWITCH, number)</Value>
<Case Value="0"><Image Name="AI_OFF.bmp" Bright="No" Luminous="No" ImageSizes="44,46"/></Case>
<Case Value="1"><Image Name="AI_ON.bmp" Bright="Yes" Luminous="Yes" ImageSizes="44,46"/></Case>
<Case Value="2"><Image Name="AI_Off.bmp" Bright="No" Luminous="Yes" ImageSizes="44,46"/></Case>
</Select>
</Element>

<Mouse>
<Area Left="0" Right="30" Top="0" Bottom="14">
<Cursor Type="UpArrow"/>
<Tooltip>APU Off</Tooltip>
<Click>0 (&gt;L:APU SWITCH, number) (L:ONE SECOND TIMER, number) 60 + (&gt;L:APU SHUTDOWN DELAY, number)</Click>
</Area>

<Area Left="0" Right="30" Top="17" Bottom="30">
<Cursor Type="DownArrow"/>
<Tooltip>APU Start</Tooltip>
<Click>2 (&gt;L:APU SWITCH, number)</Click>
</Area>
</Mouse>

</Gauge>


I want to convert this in one single click on off thing. I want it off like the click 0 but when i press i want to turn the APU on.
 
Code:
<Element>
<Visible>(A:Circuit general panel on, bool)</Visible>
<Select>
<Value>(L:APU SWITCH, bool)</Value>
<Case Value="0"><Image Name="AI_OFF.bmp" Bright="No" Luminous="No" ImageSizes="44,46"/></Case>
<Case Value="1"><Image Name="AI_ON.bmp" Bright="Yes" Luminous="Yes" ImageSizes="44,46"/></Case>
</Select>
</Element>

<Mouse>
<Area Left="0" Right="30" Top="0" Bottom="30">
<Cursor Type="DownArrow"/>
<Tooltip>APU Start</Tooltip>
<Click>(L:APU SWITCH, bool) ! (&gt;L:APU SWITCH, bool)
(L:APU SWITCH, bool)
if{ (L:ONE SECOND TIMER, number) 60 + (&gt;L:APU SHUTDOWN DELAY, number) }</Click>
</Area>
</Mouse>

What I did:
- Unified the mouse rectangles into a single one (see the "top" and "bottom" value of the new rectangle)
- Turned "L:APU Switch" into a boolean type variable (which can be either 0 or 1)
-- adapted the display condition for the switch's bitmaps accordingly
-- made the mouse rectangle toggle said variable between 0 and 1 whenever it's clicked

The "APU shutdown delay" variable was adapted to the new condition and will only be updated upon clicking the clickspot when the APU switch variable is "1", i.e. the APU is running.
 
forgot about that, ok its showing now.

Now im gonna complicate a few things... ajajajajajaja

the Generators have an <click event> like this

<Element>
<Select>
<Value>(L:APUL SWITCH POSITION, number)</Value>
<Case Value="-1"><Image Name="off_l_on.bmp" Luminous="no" Bright="yes" ImageSizes="44,46"/></Case>
<Case Value="0"><Image Name="off_no_l.bmp" Luminous="no" Bright="No" ImageSizes="44,46"/></Case>
<Case Value="1"><Image Name="off_no_l.bmp" Luminous="no" Bright="No" ImageSizes="44,46"/></Case>
</Select>
</Element>


<Mouse>
<Area Top="17" Left="0" Bottom="30" Right="30">
<Tooltip>APU Left Switch - On</Tooltip>
<Cursor Type="DownArrow"/>
<Click Kind="LeftSingle+Leave">(M:Event) 'LeftSingle' scmp 0 == if{ 1 (&gt;L:APUL SWITCH POSITION, number) (L:APU GENERATOR ONLINE, bool) if{ (L:LEFT TRANSFER BUS CURRENT SOURCE, number) (&gt;L:LEFT TRANSFER BUS PREVIOUS SOURCE, number) 2 (&gt;L:LEFT TRANSFER BUS CURRENT SOURCE, number) } } (M:Event) 'Leave' scmp 0 == if{ 1 (&gt;L:APUL SWITCH POSITION, number) }</Click>
</Area>
<Area Top="0" Left="0" Bottom="14" Right="30">
<Tooltip>APU Left Switch - Off</Tooltip>
<Cursor Type="UpArrow"/>
<Click Kind="LeftSingle+Leave">(M:Event) 'LeftSingle' scmp 0 == if{ -1 (&gt;L:APUL SWITCH POSITION, number) (L:LEFT TRANSFER BUS CURRENT SOURCE, number) 2 == if{ (L:LEFT TRANSFER BUS PREVIOUS SOURCE, number) (&gt;L:LEFT TRANSFER BUS CURRENT SOURCE, number) 0 (&gt;L:LEFT TRANSFER BUS PREVIOUS SOURCE, number) } } (M:Event) 'Leave' scmp 0 == if{ -1 (&gt;L:APUL SWITCH POSITION, number) }</Click>
</Area>
</Mouse>

</Gauge>
 
thanks you!, btw I have one more question to ask Do you know how I can make that the value of the Vspeed, when is on 0000 instead of saying the zeros i wanna make it look like dashes ----

aswell as for when the HDG autopilot is on?
 
I have an idea how to do this, but I'd need to see the part of the autopilot panel code that displays the vertical speed readout.
 
4035893488_976a14d8ee_o.jpg


This is what I mean
 
<Gauge Name="B737NG APvs Window" Version="1.0">
<Image Name="73ng_Ap_Bg2.bmp" Bright="Yes" ImageSizes="100,24"/>
<Visible>(A:Circuit general panel on, bool)</Visible>
<Element>
<Position X="0" Y="0"/>
<Text X="75" Y="24" Bright="Yes" Length="5" Font="Quartz" Color="#e6fffb" Adjust="Center" Multiline="No" Fixed="No">
<String>%((A:Autopilot vertical hold var,ft/min))%!04.0f!</String>
</Text>
</Element>
</Gauge>
 

Code:
<Gauge Name="B737NG APvs Window" Version="1.0">
   <Image Name="73ng_Ap_Bg2.bmp" Bright="Yes" ImageSizes="100,24"/>
   <Visible>(A:Circuit general panel on, bool)</Visible>
   <Element>
      <Position X="0" Y="0"/>
      <Text X="75" Y="24" Bright="Yes" Length="5" Font="Quartz" Color="#e6fffb" Adjust="Center" Multiline="No" Fixed="No">
         <String>%((A:Autopilot vertical hold var,ft/min) 0 !=)%{if}%((A:Autopilot vertical hold var,ft/min))%!04.0f!%{else}----</String>
      </Text>
   </Element>
</Gauge>


Note the "if-else" construct in the string tags. Works just the same as in regular gauge code, but in a slightly different format.
 
ok so lets see if for example I want the engines to turn when the fuel pumps are on it would be like this?

I would have to start the string with the action i want (A:A:General eng1 starter, bool) then the value? and then start it with !=)%{if}%((L:eng1 fuel pump,bool) 1 ?
 
No, if you want an ACTION (instead of a string display), the code is quite different. Also, rather than using an A: variable to READ a value from FS, you need to use a K: event to SEND a command to FS.

Code:
(A:GENERAL ENG1 FUEL PUMP ON,bool) if{ (>K:TOGGLE_STARTER1) }

Technically you don't need a 1 == after the (L:eng1 fuel pump,bool) variable (to test if it is "on"), since all by itself a boolean variable will return "true", which is all that is needed.

However this is bad coding, since if the engine 1 fuel boost pump is on, the code will constantly send the toggle starter command to FS. This is known as "flooding" and can result in sluggish operation and breaks multiple keystroke commands (like open door 2, etc.). To fix this you also need to test for the current setting of the starter:

Code:
(A:GENERAL ENG1 FUEL PUMP ON,bool) (A:GENERAL ENG STARTER,bool) ! and if{ (>K:TOGGLE_STARTER1) }

This says that if the fuel pump is on and the starter is off, then toggle the starter to on. The ! in the code tests for the inverse of the variable - i.e. if it is OFF, rather than ON.

This code has NOT been tested and is just an example.

Hope this helps,
 
thanks gibson! this is what i need to know what are the variables on the string, so i can know what to do becasue i cant understand this xml because of that lol
 
If I want to link this 2 strings:

<String>%((L:BARO ADJUST,bool) if{ (A:Kohlsman setting mb, mbar) } els{ (A:Kohlsman setting hg, inHg) } )%!5.2f!</String>
<String>%((A:INDICATED ALTITUDE,feet) 18000 &lt;)%{if}%((A:KOHLSMAN SETTING HG, inHg) 0 max 99.99 min)%!5.2f!%{else}%STD%{end}%</String>

it goes like this? or need something to devide these lines?

<Visible>(A:Circuit general panel on, bool)</Visible>
<Position X="5" Y="23"/>
<Text X="64" Y="22" Length="6" Fixed="Yes" FontWeight="700" Font="Quartz" Adjust="Center" VerticalAdjust="Center" Color="Orange" Bright="Yes">
<String>%((L:BARO ADJUST,bool) if{ (A:Kohlsman setting mb, mbar) } els{ (A:Kohlsman setting hg, inHg) } )%!5.2f!%((A:INDICATED ALTITUDE,feet) 18000 &lt;)%{if}%((A:KOHLSMAN SETTING HG, inHg) 0 max 99.99 min)%!5.2f!%{else}%STD%{end}%</String>
</Text>
 
Code:
<String>%((A:INDICATED ALTITUDE,feet) 18000 &lt;)%{if}%((L:BARO ADJUST,bool))%{if}%((A:Kohlsman setting mb, mbar))%!5.2f!%{else}%((A:Kohlsman setting hg, inHg))%!5.2f!%{end}%{else}STD%{end}
 
thank you so much!!! i manage to also make the dasehd line on the speed selector display whenever the spd hold switch is on!! thank you for the time
 
Back
Top