• 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 Switches in reverse

Messages
1,468
Country
italy
I have discovered that if I load an aircraft after another then my electrical system is in reverse. That is (A:Electrical master battery,bool) is equal to 1, but my switch is in the off position. Consequently when I turn the battery switch on the power goes off!!! I need something extra in the code or another way of writing it.
The conflict is being causes by the addition of (L:switch_pos,bool) !=
I'm attempting to detect whether the switch is in the on or off position and then using that value.
If I load said aircraft first there is no problem. But, If I load it then another and then reload it I get the above problem.
Help appreciated
vololiberista
Code:
<Gauge Name="Battery" Version="1.0">
   <Element>
      <Select>
         <Value>(A:Electrical master battery,bool) (L:switch_pos,bool)</Value>
         <Case Value="0">
            <Image Name="FUEL_SWITCH_3_OFF.bmp"/>
         </Case>
         <Case Value="1">
            <Image Name="FUEL_SWITCH_3_ON.bmp"/>
         </Case>
      </Select>
   </Element>
   <Mouse>
      <Help ID="HELPID_GAUGE_BATTERY_SWITCH"/>
      <Cursor Type="Hand"/>
        <Click>(&gt;K:TOGGLE_MASTER_BATTERY) 1 (>L:Sound_knob,enum) (L:switch_pos,bool) != if{ 0 (&gt;L:switch_pos,bool) } els{ 1 (&gt;L:switch_pos,bool) }</Click>
   </Mouse>
</Gauge>
 
This is a normal behavior.

When you change/reload an aircraft, all the LVars are reset to 0.

The solution is very simple, just add an <Update> section at the begining of the gauge and write there something like:

(for "Battery" gauge)

Code:
<Update>
    (L:InitBattery) !
    if{  
         (A:ELECTRICAL MASTER BATTERY,bool) (>L:switch_pos,bool)
         1 (>L:InitBattery)
       }
</Update>

BTW, I recommend that you use an unique identifier for each switch in your panel, as to avoid undesired updates on the same var.
Hence instead of (L:switch_pos,bool), use (L:Batteryswitch_pos,bool) and so on

Tom
 
This is a normal behavior.

When you change/reload an aircraft, all the LVars are reset to 0.

The solution is very simple, just add an <Update> section at the begining of the gauge and write there something like:

(for "Battery" gauge)

Code:
<Update>
    (L:InitBattery) !
    if{  
         (A:ELECTRICAL MASTER BATTERY,bool) (>L:switch_pos,bool)
         1 (>L:InitBattery)
       }
</Update>

BTW, I recommend that you use an unique identifier for each switch in your panel, as to avoid undesired updates on the same var.
Hence instead of (L:switch_pos,bool), use (L:Batteryswitch_pos,bool) and so on

Tom
Thanks,
as long as the actual switch is in line with (A:ELECTRICAL MASTER BATTERY,bool) at all times. I'll try out your update and see what transpires.
vololiberista


PS Everything works, thanks. There is only one other switch the "ground/flight" switch that needs to know the position of the battery switch. There are a host of other gauges that are affected by that switch.
vololiberista
 
Last edited:
Back
Top