Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Momentary buttons ?

Featured Replies

I want to create momentary buttons purely as a visual effect that are Bitmap lit up when clicked.

This is for (1) a extended function autopilot that is FS9 style xml.

and (2) for a MFD radar that is in Aces/ESP style xml .

Both instruments are in a FSX 2D panel.

 

A lit Bitmap would appear only briefly when clicked .

 

Any help would be appreciated.

 

Cheers

Karol

Karol,

 

Depending on the update frequency of the gauge a variable can be set when clicked then subtracted during the update. In this example the update freq. is at max (18Hz) so a set variable of 9 would yield a half second show.

 

Roman

 



<Update>
(G:Var1) 0 != if{ (G:Var1) -- (>G:Var1) }
</Update>


<Element>
<Position X="253" Y="110" />
<Select>
<Value>(G:Var1) 0 !=</Value>
<Case Value="0">
<Image Name="rad_switch_right.bmp"/>
</Case>
<Case Value="1">
<Image Name="rad_switch_left.bmp"/>
</Case>
</Select>
</Element>



<Area Left="271" Right="328" Top="69" Bottom="170">
<Cursor Type="Hand" />
<Click> 9 (>G:Var1) (>K:NAV2_RADIO_SWAP)</Click>
</Area>

20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

  • Author

Thanks Roman , will give it a try , I must admit it looks rather neat.

 

Cheers

Karol

This will work too:

 

 

<Click Kind="LeftSingle+RightSingle+Leave">
(M:Event) 'LeftSingle' scmp 0 ==if{  condition ok then execute code to do and bitmap on  }
(M:Event) 'RightSingle' scmp 0 ==if{  condition ok then execute code to do and bitmap on  }
(M:Event) 'Leave' scmp 0 ==if{  condition not ok then no code execution and bitmap off  }
</Click>

Jan

 

 

 

"Beatus ille qui procul negotiis..."

  • Author

Thanks Jan , that one will take a bit thinking to work it out with with some of the nasty mouse code

that I'm using.

I did my strange unified control autopilot using Roman's G:Var , fortunately it only required

7 momentary buttons , which was good seeing you can only have 9 instances of G:Var.

Another instrument that I want to convert to momentary buttons has 17 buttons , so it will require a

slightly different approach.

Instead of a case "0" bitmap I utilized the background bitmap , and displaced the lit case "1" bitmaps

up and across 1 pixel to create a movement effect.

It's a bit large but the new autopilot code is below for those interested.

 

Cheers

Karol

<Gauge Name="Autopilot" Version="1.0">
//By Karol Chlebowski @ 2012 **

<Update Frequency="18"/>
<Update>
(G:Var1) 0 != if{ (G:Var1) -- (>G:Var1) }
(G:Var2) 0 != if{ (G:Var2) -- (>G:Var2) }
(G:Var3) 0 != if{ (G:Var3) -- (>G:Var3) }
(G:Var4) 0 != if{ (G:Var4) -- (>G:Var4) }
(G:Var5) 0 != if{ (G:Var5) -- (>G:Var5) }
(G:Var6) 0 != if{ (G:Var6) -- (>G:Var6) }
(G:Var7) 0 != if{ (G:Var7) -- (>G:Var7) }
</Update>
 <Element>
   <Position X="0" Y="0"/>
   <Image Name="F-111AP_bkgd.bmp"/>
 </Element>
 <!--BUTTONS-->
 <Element>
   <!--NAV-->
   <Element>
  <Position X="81" Y="36"/>
  <Select>
    <Value>(A:Autopilot Nav1 lock,bool)</Value>
    <Case Value="1">
	  <Image Name="NAV_PB.bmp" Bright="1"/>
    </Case>
  </Select>
   </Element>
   <!--HDG-->
   <Element>
  <Position X="81" Y="10"/>
  <Select>
    <Value>(A:Autopilot heading lock,bool)</Value>
    <Case Value="1">
	  <Image Name="HDG_PB.bmp" Bright="1"/>
    </Case>
  </Select>
   </Element>
   <!--APR-->
   <Element>
  <Position X="43" Y="36"/>
  <Select>
    <Value>(A:Autopilot approach hold,bool)</Value>
    <Case Value="1">
	  <Image Name="APR_PB.bmp" Bright="1"/>
    </Case>
  </Select>
   </Element>
   <!--ALT-->
   <Element>
  <Position X="228" Y="61"/>
  <Select>
    <Value>(A:Autopilot altitude lock,bool)</Value>
    <Case Value="1">
	  <Image Name="ALT_PB.bmp" Bright="1"/>
    </Case>
  </Select>
   </Element>
   <!--LVL-->
   <Element>
  <Position X="6" Y="36"/>
  <Select>
    <Value>(A:Autopilot wing leveler, bool)</Value>
    <Case Value="1">
	  <Image Name="LVL_PB.bmp" Bright="1"/>
    </Case>
  </Select>
   </Element>
   <!--BC-->
   <Element>
  <Position X="43" Y="10"/>
  <Select>
    <Value>(A:Autopilot backcourse hold,bool)</Value>
    <Case Value="1">
	  <Image Name="BC_PB.bmp" Bright="1"/>
    </Case>
  </Select>
   </Element>
   <!--IAS-->
   <Element>
  <Position X="81" Y="61"/>
  <Select>
    <Value>(A:Autopilot airspeed hold, bool)</Value>
    <Case Value="1">
	  <Image Name="IAS_PB.bmp" Bright="1"/>
    </Case>
  </Select>
   </Element>
   <!--MCH-->
   <Element>
  <Position X="43" Y="61"/>
  <Select>
    <Value>(A:Autopilot mach hold, bool)</Value>
    <Case Value="1">
	  <Image Name="MCH_PB.bmp" Bright="1"/>
    </Case>
  </Select>
   </Element>
   <!--Y/D-->
   <Element>
  <Position X="6" Y="10"/>
  <Select>
    <Value>(A:Autopilot yaw damper, bool)</Value>
    <Case Value="1">
	  <Image Name="YD_PB.bmp" Bright="1"/>
    </Case>
  </Select>
   </Element>
   <!--MASTER-->
   <Element>
  <Position X="265" Y="61"/>
  <Select>
    <Value>(A:Autopilot master,bool)</Value>
    <Case Value="1">
	  <Image Name="APmastr_PB.bmp" Bright="1"/>
    </Case>
  </Select>
   </Element>
<!--TFR-->
<Element>
<Position X="228" Y="10"/>
<Select>
<Value>
(L:TFRcp1,bool)
</Value>
<Case Value="0">
<Image Name="TerrainTFROff.bmp"/>
</Case>
<Case Value="1">
<Image Name="TFR_PB.bmp" Bright="1"/>
</Case>
</Select>
</Element>
<Update Frequency="18"/>
<Element>
<Select>
<Value>
(L:TFRcp1,bool)
if{
(A:GROUND ALTITUDE,foot) (L:TFRcp2,foot) + (>K:AP_ALT_VAR_SET_ENGLISH)
(A:PLANE ALTITUDE,foot) (A:AUTOPILOT ALTITUDE LOCK VAR,foot) - -9 * (A:PLANE ALT ABOVE GROUND,foot) 2000 < 5 * 1 + * (>L:TFRcp3,number)
(A:PLANE ALT ABOVE GROUND,foot) (L:TFRcp3,number) + -300 <
 if{
 (A:PLANE ALT ABOVE GROUND,foot) -1 * (>K:AP_VS_VAR_SET_ENGLISH)
 }
 els{
 (L:TFRcp3,number) (>K:AP_VS_VAR_SET_ENGLISH)
 }
}
</Value>
</Select>
</Element>

<!--NAV - GPS SW-->
<Element>
   <Position X="332" Y="6"/>
  <Select>
	 <Value>(A:GPS drives nav1,bool) !</Value>
	 <Case Value="0">
		 <Image Name="TOGON.bmp"/>
	 </Case>
	 <Case Value="1">
		 <Image Name="TOGOFF.bmp"/>
	 </Case>
  </Select>
  </Element>
 </Element>
 <!--FD-->
  <Element>
   <Position X="6" Y="61"/>
  <Select>
	 <Value>(A:Autopilot flight director active,bool)</Value>
	 <Case Value="1">
	    <Image Name="FD_PB.bmp" Bright="1"/>
	 </Case>
  </Select>
  </Element>

 <!--TFR Up-Dn-->
  <Element>
   <Position X="270" Y="10" />
  <Select>
	 <Value>(G:Var1) 0 !=</Value>
	 <Case Value="1">
	   <Image Name="UP.bmp"/>
	 </Case>
  </Select>
  </Element>
  <Element>
   <Position X="270" Y="36" />
  <Select>
	 <Value>(G:Var2) 0 !=</Value>
	 <Case Value="1">
	   <Image Name="DN.bmp"/>
	 </Case>
  </Select>
  </Element>
 <!--Etrim Inc-Dec-Zero-->
  <Element>
   <Position X="352" Y="5" />
  <Select>
	 <Value>(G:Var3) 0 !=</Value>
	 <Case Value="1">
	   <Image Name="INC.bmp"/>
	 </Case>
  </Select>
  </Element>
  <Element>
   <Position X="352" Y="41" />
  <Select>
	 <Value>(G:Var4) 0 !=</Value>
	 <Case Value="1">
	   <Image Name="DEC.bmp"/>
	 </Case>
  </Select>
  </Element>
  <Element>
   <Position X="314" Y="42" />
  <Select>
	 <Value>(G:Var5) 0 !=</Value>
	 <Case Value="1">
	   <Image Name="ZERO.bmp"/>
	 </Case>
  </Select>
  </Element>
 <!--Light Prev-Next-->
  <Element>
   <Position X="383" Y="65" />
  <Select>
	 <Value>(G:Var6) 0 !=</Value>
	 <Case Value="1">
	   <Image Name="PREV.bmp"/>
	 </Case>
  </Select>
  </Element>
  <Element>
   <Position X="432" Y="65" />
  <Select>
	 <Value>(G:Var7) 0 !=</Value>
	 <Case Value="1">
	   <Image Name="NEXT.bmp"/>
	 </Case>
  </Select>
  </Element>

 <!--DISPLAYS-->
 <Element>
   <Visible>(A:Circuit general panel on, bool) (A:Avionics master switch,bool) &&</Visible>
   <!--NAV-->
   <Element>
  <Position X="120" Y="38"/>
  <FormattedText X="41" Y="17" Font="Tahoma" FontSize="18" LineSpacing="18" Adjust="Center" Color="#00CE00" Bright="Yes">
    <String>%((A:NAV1 OBS, degrees))%!03d!</String>
  </FormattedText>
   </Element>
   <!--HDG-->
   <Element>
  <Position X="120" Y="14"/>
  <FormattedText X="41" Y="17" Font="Tahoma" FontSize="18" LineSpacing="18" Adjust="Center" Color="#00CE00" Bright="Yes">
    <String>%((A:Autopilot heading lock dir, degrees))%!03d!</String>
  </FormattedText>
   </Element>
   <!--ALT-->
   <Element>
  <Position X="164" Y="63"/>
  <FormattedText X="57" Y="17" Font="Tahoma" FontSize="18" LineSpacing="18" Adjust="Right" Color="#00CE00" Bright="Yes">
    <String>%((A:Autopilot altitude lock var, feet))%!5.0f!</String>
  </FormattedText>
   </Element>
   <!--VS-->
   <Element>
  <Position X="162" Y="38"/>
  <FormattedText X="57" Y="17" Font="Tahoma" FontSize="18" LineSpacing="18" Adjust="Right" Color="#00CE00" Bright="Yes">
    <String>%((A:Autopilot vertical hold var, ft/min))%!5.0f!</String>
  </FormattedText>
   </Element>
   <!--SPEED-->
   <Element>
  <Position X="118" Y="63"/>
  <FormattedText X="44" Y="17" Font="Tahoma" FontSize="18" LineSpacing="18" Adjust="Right" Color="#00CE00" Bright="Yes">
    <String>%((L:Mach-IAS select, bool))%{if}%((A:Autopilot mach hold var, mach))%!1.2f!%{else}%((A:Autopilot airspeed hold var,knots))%!03d!%{end}</String>
  </FormattedText>
   </Element>
 <!--ELEVATOR TRIM-->
<Element>
  <Position X="319" Y="69"/>
 <Text X="45" Y="14" Bright="Yes" Length="5" Font="Tahoma" Color="%('#FFFF00' '#00FF00' (A:ELEVATOR TRIM POSITION, degrees) 10 * near 10 / 0 >= ! ?)" Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
	  <String>%((A:ELEVATOR TRIM POSITION, degrees) 10 * near 10 / )%!5.1f!</String>
  </Text>
 </Element>
 <!--TFR clearance plane-->
 <Element>
<Position X="171" Y="12"/>
<Text X="60" Y="16" Bright="Yes" Length="4" Font="Tahoma" FontSize="16"  Color="#00BE00"   Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
<String>%( (L:TFRcp2,foot) abs )%!04d!</String>
</Text>
</Element>
<!--Flt Pln LEG-->
<Element>
	  <Position X="393" Y="6"/>
	   <Text X="76" Y="15" Bright="Yes" Length="15" Font="Tahoma" FontSize="11" Color="#93FF72" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
	    <String>%Flt  Pln  LEG%</String>
	   </Text>
   </Element>
<Element>
	  <Position X="391" Y="19"/>
	  <FormattedText X="81" Y="48" Font="Tahoma" FontSize="11" LineSpacing="11" Adjust="Right" Color="#00BE00" Bright="Yes">
	    <String>%((A:GPS WP PREV ID, string))%!s!%>%((A:GPS WP NEXT ID, string))%!s!%\n%((A:GPS FLIGHT PLAN WP INDEX, number))%!02d!%-%((A:GPS FLIGHT PLAN WP COUNT, number) 1 -)%!02d!%\n%((A:GPS WP DISTANCE, nmiles))%!04.1f!% NM%\n%((A:GPS WP ETE,seconds) 3600 % 60 / int flr 60 %)%!02d! : %((A:GPS WP ETE,seconds) 60 % int flr 60 %)%!02d!%</String>
	  </FormattedText>
    </Element>
 </Element>

 <Mouse>
   <!--CRS SET-->
   <Area Left="119" Top="37" Width="22" Height="25">
  <Cursor Type="DownArrow"/>
  <Click Event="VOR1_OBI_DEC" Repeat="Yes"/>
   </Area>
   <Area Left="145" Top="37" Width="22" Height="25">
  <Cursor Type="UpArrow"/>
  <Click Event="VOR1_OBI_INC" Repeat="Yes"/>
   </Area>
   <!--HDG SET-->
   <Area Left="119" Top="12" Width="22" Height="25">
  <Cursor Type="DownArrow"/>
  <Click Event="HEADING_BUG_DEC" Repeat="Yes"/>
   </Area>
   <Area Left="145" Top="12" Width="22" Height="25">
  <Cursor Type="UpArrow"/>
  <Click Event="HEADING_BUG_INC" Repeat="Yes"/>
   </Area>
 <!--ALT SET-->
<Macro Name="Plus1000">
(A:AUTOPILOT ALTITUDE LOCK VAR,feet) 1000 +
</Macro>
<Macro Name="Minus1000">
(A:AUTOPILOT ALTITUDE LOCK VAR,feet) 1000 -
</Macro>
<Macro Name="Button1">(M:Event) 'RightSingle' scmp 0 == if{ (>K:AP_ALT_VAR_INC) }
 (M:Event) 'LeftSingle' scmp 0 ==  if{ (>K:AP_ALT_VAR_DEC) }
 (M:Event) 'WheelUp' scmp 0 == if{ @Plus1000 (>K:AP_ALT_VAR_SET_ENGLISH) }
 (M:Event) 'WheelDown' scmp 0 == if{ @Minus1000 (>K:AP_ALT_VAR_SET_ENGLISH) }</Macro> 
   <Area Left="171" Top="62" Width="60" Height="25">
 <Tooltip>Set ALT</Tooltip>
 <Click Kind="LeftSingle+RightSingle+WheelUp+WheelDown">@Button1</Click>
 <Cursor Type="Hand" />
 </Area>
   <!--VS SET-->
   <Area Left="171" Top="37" Width="25" Height="25">
  <Cursor Type="DownArrow"/>
  <Click Event="AP_VS_VAR_DEC" Repeat="Yes"/>
   </Area>
   <Area Left="197" Top="37" Width="25" Height="25">
  <Cursor Type="UpArrow"/>
  <Click Event="AP_VS_VAR_INC" Repeat="Yes"/>
   </Area>
   <!--SPEED SET-->
   <Area Left="119" Top="62" Width="22" Height="25">
  <Click Repeat="Yes">0 (L:Mach-IAS select, bool) if{ (>K:AP_MACH_VAR_DEC) } els{ (>K:AP_SPD_VAR_DEC) }</Click>
  <Cursor Type="DownArrow"/>
   </Area>
   <Area Left="145" Top="62" Width="22" Height="25">
  <Click Repeat="Yes">0 (L:Mach-IAS select, bool) if{ (>K:AP_MACH_VAR_INC) } els{ (>K:AP_SPD_VAR_INC) }</Click>
  <Cursor Type="UpArrow"/>
   </Area>
   <!--NAV-->
   <Area Left="81" Top="37" Width="34" Height="20">
  <Cursor Type="Hand"/>
  <Click Event="AP_NAV1_HOLD"/>
   </Area>
   <!--HDG-->
   <Area Left="81" Top="11" Width="34" Height="20">
  <Cursor Type="Hand"/>
  <Click Event="AP_PANEL_HEADING_HOLD"/>
   </Area>
   <!--APR-->
   <Area Left="43" Top="37" Width="34" Height="20">
  <Cursor Type="Hand"/>
  <Click Event="AP_APR_HOLD"/>
   </Area>
   <!--ALT-->
   <Area Left="228" Top="62" Width="34" Height="20">
  <Cursor Type="Hand"/>
  <Click Event="AP_PANEL_ALTITUDE_HOLD"/>
   </Area>
   <!--LVL-->
   <Area Left="6" Top="37" Width="34" Height="20">
  <Cursor Type="Hand"/>
  <Click Event="AP_WING_LEVELER"/>
   </Area>
   <!--B/C-->
   <Area Left="43" Top="11" Width="34" Height="20">
  <Cursor Type="Hand"/>
  <Click Event="AP_BC_HOLD"/>
   </Area>
   <!--IAS-->
   <Area Left="81" Top="62" Width="34" Height="20">
  <Cursor Type="Hand"/>
  <Click>0 (>L:Mach-IAS select, bool) 0 (>K:AP_PANEL_SPEED_HOLD)</Click>
   </Area>
   <!--MCH-->
   <Area Left="43" Top="62" Width="34" Height="20">
  <Cursor Type="Hand"/>
 <Click>1 (>L:Mach-IAS select, bool) 0 (>K:AP_PANEL_MACH_HOLD)</Click>
   </Area>
   <!--Y/D-->
   <Area Left="6" Top="11" Width="34" Height="20">
  <Cursor Type="Hand"/>
 <Click Event="YAW_DAMPER_TOGGLE"/>
   </Area>
   <!--MASTER-->
   <Area Left="265" Top="62" Width="40" Height="20">
  <Cursor Type="Hand"/>
   <Click Repeat="No">(A:Autopilot Master,bool) if{ 0 (>L:HOLD SPEED,bool) (>K:AP_AIRSPEED_OFF) (>K:AP_MACH_OFF) (>K:AP_ALT_HOLD_OFF) (>K:AP_HEADING_OFF) (>K:AP_NAV1_HOLD_OFF) (>K:AP_WING_LEVELER_OFF) (>K:YAW_DAMPER_OFF) (>K:AP_APR_HOLD_OFF) } 0 (>K:AP_MASTER)</Click>
   </Area>
<!--TRIM-->
<Area Left="353" Top="6" Width="34" Height="20"> 9 (>G:Var6)
	    <Cursor Type="UpArrow"/>
  <Click Repeat="Yes"> 9 (>G:Var3) (>K:ELEV_TRIM_UP)</Click>
	 </Area>
  <Area Left="353" Top="42" Width="34" Height="20">
	    <Cursor Type="DownArrow"/>
  <Click Repeat="Yes"> 9 (>G:Var4) (>K:ELEV_TRIM_DN)</Click>
	 </Area>
  <Area Left="314" Top="42" Width="34" Height="20">
    <Tooltip>%Zero Elevator Trim</Tooltip>
	 <Cursor Type="Hand"/>
  <Click Repeat="Yes"> 9 (>G:Var5) (>K:AXIS_ELEV_TRIM_SET)</Click>
	 </Area>
  <!--TFR-->
<Area Left="228" Top="11" Width="34" Height="20">
<Tooltip>TFR ON-OFF</Tooltip>
<Cursor Type="Hand"/>
<Click>
(L:TFRcp1,bool) 0 == (>L:TFRcp1,bool)
(A:AUTOPILOT ALTITUDE LOCK VAR,foot) (>L:TFRcp2,foot)
</Click>
</Area>
<Area Left="270" Top="11" Width="34" Height="20">
<Cursor Type="UpArrow"/>
<Click Repeat="Yes"> 9 (>G:Var1)
(L:TFRcp2,foot) d 99900 <
if{ 100 + (>L:TFRcp2,foot) }
</Click>
</Area>  
  <Area Left="270" Top="37" Width="34" Height="20">
<Cursor Type="DownArrow"/>
<Click Repeat="Yes"> 9 (>G:Var2)
(L:TFRcp2,foot) d 0 >
if{ 100 - (>L:TFRcp2,foot) }
</Click>
</Area>
<Macro Name="Button1">(L:VFDDAT mode,enum) 4 == (L:ChgWPt, number) (A:GPS FLIGHT PLAN WP COUNT, number) 0 >
if{
(A:GPS FLIGHT PLAN WP INDEX, number) -- (> L:ChgWPt, number)
(L:ChgWPt, number) (> C:fs9gps:directToActivateLeg)
(L:ChgWPt, number) (> C:fs9gps:FlightPlanWaypointIndex)
(L:ChgWPt, number) (> C:fs9gps:FlightPlanDirectToWaypoint)
(L:ChgWPt, number) (> C:fs9gps:FlightPlanActiveWaypoint) }</Macro>
   <Area Left="383" Top="66" Width="41" Height="18">
<Tooltip>Set PREV Leg</Tooltip>
  <Cursor Type="DownArrow"/>
  <Click Kind="LeftSingle"> 9 (>G:Var6) @Button1</Click>
   </Area>
<Macro Name="Button2">(L:VFDDAT mode,enum) 4 == (L:ChgWPt, number) (A:GPS FLIGHT PLAN WP COUNT, number) 0 - <
if{
(A:GPS FLIGHT PLAN WP INDEX, number) ++ (> L:ChgWPt, number)
(L:ChgWPt, number) (> C:fs9gps:directToActivateLeg)
(L:ChgWPt, number) (> C:fs9gps:FlightPlanWaypointIndex)
(L:ChgWPt, number) (> C:fs9gps:FlightPlanDirectToWaypoint)
(L:ChgWPt, number) (> C:fs9gps:FlightPlanActiveWaypoint) }</Macro>
   <Area Left="432" Top="66" Width="41" Height="18">
<Tooltip>Set NEXT Leg</Tooltip>
  <Cursor Type="UpArrow"/>
  <Click Kind="LeftSingle"> 9 (>G:Var7) @Button2</Click>
   </Area>
 <Area Left="330" Top="11" Width="20" Height="29">
  <Help ID="HELPID_GAUGE_NAV_GPS_SWITCH"/>
  <Cursor Type="Hand"/>
  <Click Event="TOGGLE_GPS_DRIVES_NAV1"/>
  </Area>
<!--FD-->
   <Area Left="6" Top="62" Width="34" Height="20">
  <Cursor Type="Hand"/>
 <Click Event="TOGGLE_FLIGHT_DIRECTOR"/>
   </Area>  
   </Mouse>
   </Gauge>

  • Moderator

I avoid using G:Varn completely, and stick to simple Lvars, such as (L:G1,enum) through (L:G99999999,enum)...

 

...just kidding about the huge number, but the point remains that for practical purposes, the number is more than sufficient. Typically though I will give the variables identifiable names to keep my sanity!

 

e.g., instead of (G:Var5) I'd use (L:ElevTrimSet,enum)... :Nerd:

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

One could evolve this even further.. Using only 2 user VARs you could theoretically have as many as 16,777,215 switches.. ( A little more over-kill :LMAO: ) The prerequisite is that the timing should be no more than 0.5 seconds.. It's nearly impossible for one to move the mouse and then click within that time. This example uses L:Vars, but..... For stuff like timers etc... It is in my opinion to use G:VARs for 1 reason,, they do not intercommunicate. You could use the same <Macros> and design for many different gauges without pooching up the timers.

 

Roman

 

 


<!-- 
(L:Switch_Timer, number) = The switch number assigned to the timer.
(L:Switch_Timer, number) = The time ( in cycles ) that the switch counts down. 
-->

<Macro Name="TIMER_ENG">9 (>L:Switch_Timer, number) @1 (>L:Switch_Number, number)</Macro>

<Macro Name="TIMER_EVAL">(L:Switch_Number, number) @1 == (L:Switch_Timer, number) 0 != and</Macro>

<Update Frequency="18">
(L:Switch_Timer, number) 0 != if{ (L:Switch_Timer, number) -- (>L:Switch_Timer, number) } 
<!-- Not really necessary, but better to cover all the bases -->
(L:Switch_Timer, number) 0 == if{ 0 (>L:Switch_Number, number) } 
</Update>


<Element Name="Switch 1">
<Position X="10" Y="10" />
<Select>
<Value>@TIMER_EVAL(1)</Value>
<Case Value="0">
<Image Name="rad_switch_right.bmp"/>
</Case>
<Case Value="1">
<Image Name="rad_switch_left.bmp"/>
</Case>
</Select>
</Element>

<Element Name="Switch 2">
<Position X="20" Y="20" />
<Select>
<Value>@TIMER_EVAL(2)</Value>
<Case Value="0">
<Image Name="rad_switch_right.bmp"/>
</Case>
<Case Value="1">
<Image Name="rad_switch_left.bmp"/>
</Case>
</Select>
</Element>

<Element Name="Switch 3">
<Position X="30" Y="30" />
<Select>
<Value>@TIMER_EVAL(3)</Value>
<Case Value="0">
<Image Name="rad_switch_right.bmp"/>
</Case>
<Case Value="1">
<Image Name="rad_switch_left.bmp"/>
</Case>
</Select>
</Element>

<Element Name="Switch 4">
<Position X="40" Y="40" />
<Select>
<Value>@TIMER_EVAL(4)</Value>
<Case Value="0">
<Image Name="rad_switch_right.bmp"/>
</Case>
<Case Value="1">
<Image Name="rad_switch_left.bmp"/>
</Case>
</Select>
</Element>

<Element Name="Switch 5">
<Position X="50" Y="50" />
<Select>
<Value>@TIMER_EVAL(5)</Value>
<Case Value="0">
<Image Name="rad_switch_right.bmp"/>
</Case>
<Case Value="1">
<Image Name="rad_switch_left.bmp"/>
</Case>
</Select>
</Element>

<Mouse>

<Area Name="Switch 1" Left="10" Right="20" Top="10" Bottom="20">
<Cursor Type="Hand"/>
<Click>@TIMER_ENG(1) (DO_SOMETHING_HERE)</Click>
</Area>

<Area Name="Switch 2" Left="20" Right="30" Top="20" Bottom="30">
<Cursor Type="Hand"/>
<Click>@TIMER_ENG(2) (DO_SOMETHING_HERE)</Click>
</Area>

<Area Name="Switch 3" Left="30" Right="40" Top="30" Bottom="40">
<Cursor Type="Hand"/>
<Click>@TIMER_ENG(3) (DO_SOMETHING_HERE)</Click>
</Area>

<Area Name="Switch 4" Left="40" Right="50" Top="40" Bottom="50">
<Cursor Type="Hand"/>
<Click>@TIMER_ENG(4) (DO_SOMETHING_HERE)</Click>
</Area>

<Area Name="Switch 5" Left="50" Right="60" Top="50" Bottom="60">
<Cursor Type="Hand"/>
<Click>@TIMER_ENG(5) (DO_SOMETHING_HERE)</Click>
</Area>

</Mouse>

20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Using only 2 user VARs you could theoretically have as many as 16,777,215 switches..

 

Roman, you have a big airplane ...

 

It is in my opinion to use G:VARs for 1 reason,, they do not intercommunicate.

 

I agree with you and Bill regarding G:Vars. I use G:Vars for timers (probably learned that from you in fact), but I completely agree with Bill that the inability to give them a descriptive name is nuts. Can you imagine if that limitation had been applied to L:Vars?

 

Bob

Bob,

 

Yes, exactly. There a times where the G: can actually help... Be sparingly.. 9 is all you get. :-) That is why I will have only 3 functions using G: in my programming. Timing, Initialization as they reset on reload, and interim variables that must stay alive during gauge reads, but must reset on loads & are minuscule vars, not needed elsewhere, but needed. So figuring out which is which is not a problem... <-- COMMENTS HELP FOR THIS -->

 

I need 10 of these just for the right side elevator trim so ---- :Just Kidding:

 

http://www.listoid.com/image/135/list_3_135_20101206_061508_181.jpg

 

 

 

 

Roman

20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.