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

FSXA Lamp Test Code Not Working

Messages
1,084
Country
us-northcarolina
I need to have a gauge that is a lamp test switch. I found this code and modified it by removing ACEs stuff at the top which did not look like XML and I didn't understand it. So with my xml code manual I created this gauge. The XML Validator online says no errors and the switch is visible on the panel but it does not work no click movement. Somebody help me with this please?

[ICODE
<Gauge Name="Lamp_Test_Switch" Version="1.0">
<Element>
<Select>
<Value>(G:Var1)</Value>
<Case Value="0">
<Image Name="switch_off.bmp" ImageSizes="25,25"/>
</Case>
<Case Value="1">.
<Image Name="switch_on.bmp" ImageSizes="25,25"/>
</Case>
</Select>
</Element>

<MouseArea id="MouseArea">
<FloatPosition>0.000,0.000</FloatPosition>
<Size>25,39</Size>
<MouseArea id="Lamp Test Switch">
<FloatPosition>0.000,0.000</FloatPosition>
<Size>25,39</Size>
<CursorType>Hand</CursorType>
<MouseClick id="MouseClick">
<Script>
(M:Event) &apos;LeftSingle&apos; scmp 0 == if{ 1 (&gt;L:Lamp Test,bool) }
(M:Event) &apos;LeftRelease&apos; scmp 0 == if{ 0 (&gt;L:Lamp Test,bool) }
</Script>
<ClickType>LeftSingle+LeftRelease</ClickType>
</MouseClick>
<Tooltip id="Tooltip">
<DefaultId></DefaultId>
</Tooltip>
</MouseArea>

</Gauge>

][/ICODE]

The XML Code expert is probably going to look at this and just shake their head. I know just enough to get myself all confused I would appreciate this being fixed so it works. Thank you.
 
An easy version of that type of switch (tested in P3DV5 only, but should work anywhere)


Code:
<Gauge Name="Lamp_Test_Switch" Version="1.0">

<Element>
<Select>
<Value>(L:Lamp Test,bool)</Value>
 <Case Value="0">
   <Image Name="switch_off.bmp"/>
 </Case>
 <Case Value="1">.
   <Image Name="switch_on.bmp"/>
 </Case>
</Select>
</Element>

<Mouse>
<Cursor Type="Hand"/>
<Click Kind="LeftSingle+LeftRelease">
 (M:Event) 'LeftSingle' scmp 0 ==
    if{ 1 (&gt;L:Lamp Test,bool) }
 (M:Event) 'LeftRelease' scmp 0 ==
    if{ 0 (&gt;L:Lamp Test,bool) }
</Click>
</Mouse>

</Gauge>

Walter
 
that's great thank you much. The switch works momentarily as it should but it does not illuminate the lamps on the landing gear panel which it should. I checked it in the XML Validator online which I use and there are no errors, but in Notepad++ the M events are black type as is (L:Lamp Test,bool) which I don't think is correct, they should be in color to be correctly coded am I right?
 
Last edited:
What variable are the gear lights looking for to illuminate when the test switch is in the on position? Walter didn't write your code, he provided an example of XML that works for the momentary switch control. You will need to ensure that your gear lights are looking at the correct variable to be lit when the test switch is on.
 
I am including the code here for one of the gear lights. I thought that I had them perfectly on one panel and no matter what I did by pixel locations they were all discombulated in FSX and I don't know enough how to unscramble that so I just created them as individuals. Here is the left down code. Can you please add to it what I need and I can follow that for the rest of them, right?

XML:
<Gauge Name="LEFT GEAR DOWN" Version="1">
   <Element>
      <Visible>(A:Circuit general panel on, bool)</Visible>

   <Element>
      <Select>
         <Value>(A:Gear left position,percent)  near 100 ==</Value>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action="0"/>
         </Failures>
         <Case Value="1">
            <Image Name="GEAR_LIGHT_DOWN.bmp" Bright="Yes"/>
         </Case>
      </Select>
   </Element>
   </Element>
   <Mouse>

         <Tooltip>LEFT GEAR LIGHT</Tooltip>

   </Mouse>
   </Gauge>
 
You would need to add another variable to the Value line above, something like:

<Value>(A:Gear left position,percent) near 100 == (L:Gear test switch, bool) || </Value>

(This means "light the lamp if the gear is down OR the gear test switch is TRUE".)

Now change the value of the gear test switch variable in the switch gauge when it is desired to have the lights turn on.

(L:Gear test switch, bool) ! (>L:Gear test switch, bool)

(This means "switch the variable from FALSE to TRUE, or from TRUE to FALSE".)

Remember to switch the variable back again when finished to turn the lights off.
 
You would need to add another variable to the Value line above, something like:

<Value>(A:Gear left position,percent) near 100 == (L:Gear test switch, bool) || </Value>

(This means "light the lamp if the gear is down OR the gear test switch is TRUE".)

Now change the value of the gear test switch variable in the switch gauge when it is desired to have the lights turn on.

(L:Gear test switch, bool) ! (>L:Gear test switch, bool)

(This means "switch the variable from FALSE to TRUE, or from TRUE to FALSE".)

Remember to switch the variable back again when finished to turn the lights off.
I understand how to add the code to the landing gear lights and I did that, but not how to add the code to the lamp test switch which as you said Walter only gave me a momentary switch code. Can you add complete how that should go please. The gauge is called lamp test switch not gear test switch btw but I changed that when I added it into the lights.
 
To make your lamp test persistent is just a small change to your light test code.

Code:
<Gauge Name="Lamp_Test_Switch" Version="1.0">

<Element>
<Select>
<Value>(L:Lamp Test,bool)</Value>
 <Case Value="0">
   <Image Name="switch_off.bmp"/>
 </Case>
 <Case Value="1">.
   <Image Name="switch_on.bmp"/>
 </Case>
</Select>
</Element>

<Mouse>
<Cursor Type="Hand"/>
<Click>
    (L:Lamp Test,bool) ! (&gt;L:Lamp Test,bool)
</Click>
</Mouse>

</Gauge>

Switch starts out in the Off state.
First click set in to On.
Next click sets it to Off.

Now, in your left gear gauges change

<Value>(A:Gear left position,percent) near 100 == (L:Gear test switch, bool) || </Value>

to

<Value>(A:Gear left position,percent) near 100 == (L:Lamp Test,bool) || </Value>

The light for your Left gear will go on when the gear is down or the lamp test switch is on.

The same for your other gear gauges.
 
To make your lamp test persistent is just a small change to your light test code.

Code:
<Gauge Name="Lamp_Test_Switch" Version="1.0">

<Element>
<Select>
<Value>(L:Lamp Test,bool)</Value>
 <Case Value="0">
   <Image Name="switch_off.bmp"/>
 </Case>
 <Case Value="1">.
   <Image Name="switch_on.bmp"/>
 </Case>
</Select>
</Element>

<Mouse>
<Cursor Type="Hand"/>
<Click>
    (L:Lamp Test,bool) ! (&gt;L:Lamp Test,bool)
</Click>
</Mouse>

</Gauge>

Switch starts out in the Off state.
First click set in to On.
Next click sets it to Off.

Now, in your left gear gauges change

<Value>(A:Gear left position,percent) near 100 == (L:Gear test switch, bool) || </Value>

to

<Value>(A:Gear left position,percent) near 100 == (L:Lamp Test,bool) || </Value>

The light for your Left gear will go on when the gear is down or the lamp test switch is on.

The same for your other gear gauges.
That is great Walter thanks again. I am having great success in P3D V4.5 with it. FSX and Windows 10 just don't work totally well together. They ALMOST work together but just when you think it is all right it's not. I am going to stick exclusively with my P3D. Once I have the panel all set, I have to repaint highly polished aluminum finish on the aircraft which IS different in P3D V4 than it is in FSX. I downloaded some helpful tutorials to use when I am ready. I tried using FSX skills I have learned but I am not happy with it. BUT one thing at a time. Before I sign off a big thank you for sticking with me helping all day today. The lamp test gauge works perfectly just as you said: one click all the landing gear lights on and one click test off. Now I'm going to have dinner before church service tonight. Again thanks have a blessed evening whatever you do.

Richard

Richard
 
Last edited:
Back
Top