• 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 A: variable

Messages
189
Country
hungary
Hello

I'd like to know if it is possible to give a value to an 'A:' parameter in XML Code ? I mean this form for example :

Code:
L:bat_sw_init, bool ) 0 ==
if{ 0 (>A:ELECTRICAL MASTER BATTERY, bool) 1 (>L:bat_sw_init, bool ) }    
(A:ELECTRICAL MASTER BATTERY, bool) 50 *

I want the switch in the OFF position when I first load the plane. Maybe I should animate the switch with an L: variable, and make the real code in the 'CallbackCode' section?
 
Hello

I'd like to know if it is possible to give a value to an 'A:' parameter in XML Code?

I want the switch in the OFF position when I first load the plane. Maybe I should animate the switch with an L: variable

A:Vars are read only so you cannot give them a value. You can make use of token variables to turn off the battery master, however. 1 (>K:MASTER_BATTERY) for "On", and 0 (>K:MASTER_BATTERY) for "Off".

Otherwise, you are right that you can create L:Vars that can do many things.
 
Last edited:
Thanks !

After some thinking I found out this code and it works :

Code:
<PartInfo>
        <Name>switch_master_battery</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                (L:bat_sw_init, bool ) 0 ==
                if{ 0 (&gt;L:bat_sw, bool) 1 (&gt;L:bat_sw_init, bool ) }    
                (L:bat_sw, bool) 50 * 
                </Code>
                <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <CallbackCode>                  
              (M:Event) 'LeftSingle' scmp 0 ==  
                if{ (L:bat_sw, bool) ! (&gt;L:bat_sw, bool)  (>K:TOGGLE_MASTER_BATTERY) }
           </CallbackCode>
        </MouseRect>
    </PartInfo>
 
I'm wrong... It seems the state of the ELECTRICAL MASTER BATTERY variable is always 1 at startup...
 
I'm wrong... It seems the state of the ELECTRICAL MASTER BATTERY variable is always 1 at startup...

No, the state of MASTER BATTERY is whatever it was when you last used the aircraft (or change aircraft). There's no need to get fancy, this simple script will do what you want... :D

Code:
<PartInfo>
        <Name>switch_master_battery</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                   (A:ELECTRICAL MASTER BATTERY, bool)
                </Code>
                <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <CallbackCode>                  
                 (>K:TOGGLE_MASTER_BATTERY) }
           </CallbackCode>
        </MouseRect>
    </PartInfo>
 
Ok, you are right, but when I reload the plane or change to an other livery, battery switches to the other state then it was before, but I like to achieve to set that switch to OFF at every startup :)
 
Will this one help you?

One I'm using so the parking brake is set everytime the airplane is loaded.
Just modify to your own need.

Code:
	<PartInfo>
    <Name>parking_brake_set_logic</Name>
    <AnimLength>10</AnimLength>
    <Animation>
      <Parameter>
        <Code>
		(L:Check Parking Brake, bool) 0 ==
		(A:SIM ON GROUND,bool) and
		
		if{ (>K:PARKING_BRAKES) 1 (>L:Check Parking Brake, bool) }
		els{ 1 (>L:Check Parking Brake, bool) }
		</Code>
      </Parameter>
    </Animation>
  </PartInfo>
 
Last edited:
Ok, you are right, but when I reload the plane or change to an other livery, battery switches to the other state then it was before, but I like to achieve to set that switch to OFF at every startup :)

If you turn the battery off before loading a new aircraft, it should still be off when you finish loading.

If you want to have every aircraft load with the battery off, then load your default flight (usually the C172), shut everything down, then re-save as the "default flight."
 
Here is an interesting twist. When I load my a/c after initialising the sim it has a cold cockpit. If I'm playing aound with FS panel Studio I have to switch to another a/c e.g Vickers Vimmy and then back to the a/c with the modified gauges. Now the switches are all in the same position but the cockpit "has warmed up". So what I do is switch to night view "cockpit is cold again" and then back to day view "cockpit still chilly".. Weird!
 
LOL, Vololibirista! Only with your ultra, super sophisticated panels could this be happening...

:D
 
I have got the same problem, with battery and others switches or equipments state.
I would create a real "cold and dark" situtation on a aircraft.

So, I have found the solution to write in a gauge, an update section, that reinit the aircraft when It is loaded :

Code:
(A:Sim On Ground, bool) 1 ==
(L:tempo,number) 2 + (P:Absolute time, seconds) &lt; and
(L:SimFlight, bool) 0 == and if{ 
				1 (>K:SIM_RESET)
				(A:GENERAL ENG1 FUEL VALVE, bool) 1 == if{ 1 (>K:TOGGLE_FUEL_VALVE_ENG1) }
				(A:GENERAL ENG2 FUEL VALVE, bool) 1 == if{ 1 (>K:TOGGLE_FUEL_VALVE_ENG2) }
				(A:GENERAL ENG FUEL PUMP SWITCH:1,bool) 1 == if{ 1 (>K:TOGGLE_ELECT_FUEL_PUMP1) }
				(A:GENERAL ENG FUEL PUMP SWITCH:2,bool) 1 == if{ 1 (>K:TOGGLE_ELECT_FUEL_PUMP2) }
				(A:GENERAL ENG GENERATOR SWITCH:1, bool) 1 == if{ 1 (>K:TOGGLE_ALTERNATOR1) }
				(A:GENERAL ENG GENERATOR SWITCH:2, bool) 1 == if{ 1 (>K:TOGGLE_ALTERNATOR2) }
				1 (>L:VOR 1 Switch, number)
				1 (>L:VOR 2 Switch, number)
				1 (>K:APU_OFF_SWITCH)
				2 (>L:Panel Cabin Lights, number)
				(A:Brake Parking Indicator, bool) 0 == if{ 1 (>K:PARKING_BRAKES) }
				1 (>K:FLAPS_UP)
				1 (>L:Inertial Sys OnOff,number)
				3 (>K:HYDRAULIC_SWITCH_TOGGLE)
				(A:Turb Eng1 N2,percent) 100 &gt; if{ 1 (>K:TOGGLE_MASTER_STARTER_SWITCH) }
				(A:Turb Eng2 N2,percent) 100 &gt; if{ 2 (>K:TOGGLE_MASTER_STARTER_SWITCH) }
				(A:Turb Eng Master Starter Switch:1,bool) 1 == if{ 1 (>K:TOGGLE_MASTER_STARTER_SWITCH) }
				(A:Turb Eng Master Starter Switch:2,bool) 1 == if{ 2 (>K:TOGGLE_MASTER_STARTER_SWITCH) } 												
				(A:CIRCUIT GENERAL PANEL ON, bool) 1 == if{ 1 (>L:Eng1 Bleed, enum) 1 (>L:Eng2 Bleed, enum) }
				(A:TURB ENG IGNITION SWITCH:1, bool) 1 == if{ 1 (>K:TURBINE_IGNITION_SWITCH_TOGGLE) }
				1 (&gt;K:LANDING_LIGHT_UP)
				1 (&gt;K:LANDING_LIGHT_UP)
				1 (&gt;K:LANDING_LIGHT_UP)
				1 (&gt;K:LANDING_LIGHT_UP)
				1 (&gt;K:LANDING_LIGHT_UP)
				1 (&gt;K:LANDING_LIGHT_UP)
				1 (&gt;K:LANDING_LIGHT_UP)
				1 (&gt;K:LANDING_LIGHT_UP)
				1 (&gt;K:LANDING_LIGHT_UP)
				1 (&gt;K:LANDING_LIGHT_UP)
				1 (&gt;K:LANDING_LIGHT_UP)
				(A:Fly By Wire Sec Switch, bool) 1 ==  if{ 1 (>K:FLY_BY_WIRE_ELAC_TOGGLE)
														1 (>K:FLY_BY_WIRE_SEC_TOGGLE)
														1 (>K:FLY_BY_WIRE_FAC_TOGGLE)
														2 (>K:FLY_BY_WIRE_ELAC_TOGGLE)
														2 (>K:FLY_BY_WIRE_SEC_TOGGLE)
														2 (>K:FLY_BY_WIRE_FAC_TOGGLE)
														3 (>K:FLY_BY_WIRE_SEC_TOGGLE)
														1 (>L:FBW,bool)
														}
				(A:Eng hydraulic pressure:1,psi) 50 &gt; if{ 1 (>K:TOGGLE_MASTER_STARTER_SWITCH) 1 (>K:HYDRAULIC_SWITCH_TOGGLE) }
				(A:Eng hydraulic pressure:2,psi) 50 &gt; if{ 2 (>K:TOGGLE_MASTER_STARTER_SWITCH) 2 (>K:HYDRAULIC_SWITCH_TOGGLE) }
				(A:Electrical Master Battery, bool) 1 == if{ 1 (>K:TOGGLE_MASTER_BATTERY) }
				1 (>L:SimFlight, bool)
							}



This code init my aircraft, when is on the ground in cold and dark state, same is the aircraft had the engines turns when saved flight.
I reset all the system about the engine startup. I needed of this code to create cold and dark state and real startup engines process (with bleeds).

I must add a temporisation, because, the load of the aircraft (and of the gauges) seems to be asynchronous; So, with the 2 seconds of delay, I am sure that all works. I adjust also the takeoff lights.

L:SimFlight allow that the code is executed once.

I have another code, to reinit, when the aircraft is airbone.

This is an example; You can put the code like you want.
 
Last edited:
You can add a code like this in any gauge; no importance, since it will be executed only once.

The only important thing is to put it in a following section

If you want just turn off the battery when you load a flight :

Code:
<Update>
     <Script>

A:Sim On Ground, bool) 1 ==
(L:tempo,number) 2 + (P:Absolute time, seconds) &lt; and
(L:SimFlight, bool) 0 == and if{ 1 (>K:SIM_RESET) (A:Electrical Master Battery, bool) 1 == if{ 1 (>K:TOGGLE_MASTER_BATTERY) } 1 (>L:SimFlight, bool) }	


[I]optional other gauge code[/I]


     </Script>
</Update>

In my case, I have a gauge, without bitmap, whickh manage the fuel system of my aircraft, and I have put the aircraft init code in this gauge.
 
Last edited:
I see. It's possible to make an independent xml-gauge for the init ? Like this :

Code:
<Gauge Name="PWDT Z142 init" Version="1.0">
 
<Update>
     <Script>
       (A:Sim On Ground, bool) 1 ==
       (L:tempo,number) 2 + (P:Absolute time, seconds) &lt; and
       (L:SimFlight, bool) 0 == and 
        if{ 1 (>K:SIM_RESET) (A:Electrical Master Battery, bool) 1 == if{ 1 (>K:TOGGLE_MASTER_BATTERY) } 1 (>L:SimFlight, bool) }	
</Script>
</Update>
</Gauge>
 
...and one more question, according to SDK document :

The > sign is not a legal character in XML, and will appear as &gt in XML documents.


I have to you use > or &gt sign?
 
For FS you can indeed use >, but you cannot use < and some other symbols. That said, I never use them and always use the &gt; format instead.
 
">" works always to assign a value to a L,G C Variable. example : "1 (>L:Myvar,number)" always works

But in a test, It doesn't always works, so use "&gt;" or &lt;" in conditional test : Example : "(A:Indicated Latitude) (L:MyVariable,enum) > if{..." doesn't works sometimes (mysterious) so in this case, use "&gt;".
 
Last edited:
Thanks all your helps ! Finally I put this simple code, and it's doing what I want :

Code:
(A:ELECTRICAL MASTER BATTERY, bool) 1 == 
(L:init_batt, bool) 0 == &amp;&amp;
if{ 1 (>K:TOGGLE_MASTER_BATTERY) 1 (>L:init_batt, bool) }
(A:ELECTRICAL MASTER BATTERY, bool) 50 *

A made the similar logic to the other switches, except which works with L: variables, because they have '0' value by default.
 
Hi

I have a queston about (A:ELECTRICAL GENALT BUS VOLTAGE:index) variable. It is possible to adjust the charging of the alternator/generator in .cfg or in .air files? In my plane when the engine runs at idling (~500rpm) there is no charge from the generator, it 'comes' approx. above 1000 rpm only. I want to setup the annuciator light for generator charging, but it's goes off instatly when the engine is running by default.
 
Back
Top