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

Doubts about the code

Messages
126
Country
italy
If I have a switch to multiple locations with different functions such as 3 a b c.
1) How do I write the code so that pressing it again to the same mode this does not go off?
 
Last edited:
Code:
(L:Variable, enum) ++ 3 min (>L:Variable, enum)

This will increase a variable to a maximum value of 3.


Code:
(L:Variable, enum) -- 0 max (>L:Variable, enum)

This will decrease a variable to a minimum of 0.
 
Perhaps I did not explain.
For example, these are the codes written for the "alt arm" and "alt hold"
I am taken from a panel made by Ken Mitchell:

ALT HOLD: <Click> (L: AUTOPILOT_SELECT, number) 0! = (L: FLIGHT DIRECTOR SWITCHES, enum) 0! = || (L: AP_TURBULENCE_MODE, bool)! & Amp; & amp; (L: AP_GLIDESLOPE_MODE, enum) 2! = & Amp; & amp; if {5 (& gt; L: l1011km_sound_id, number) (A: Autopilot altitude lock, bool) (L: AP_PITCH_MODE, enum) == 1 & amp; & amp; {if (& gt; K: AP_PANEL_ALTITUDE_OFF, bool) 0 (& gt; L: AP_PITCH_MODE, enum) (A: Autopilot master, bool)! (L: FLIGHT DIRECTOR SWITCHES, enum) == 0 (A: AUTOPILOT FLIGHT DIRECTOR ACTIVE, bool) & amp; & amp; & Amp; & amp; if {(& gt; K: TOGGLE_FLIGHT_DIRECTOR, bool)}} els {(& gt; K: AP_PANEL_ALTITUDE_ON, bool) 1 (& gt; L: AP_PITCH_MODE, enum) (A: Indicated Altitude, feet) (& gt; K: AP_ALT_VAR_SET_ENGLISH)} } </ Click>

ALT ARM: <Click> (A: Autopilot master, bool) (L: FLIGHT DIRECTOR SWITCHES, enum) 0! = || (L: AP_TURBULENCE_MODE, bool)! & Amp; & amp; if {5 (& gt; L: l1011km_sound_id, number) (L: ALTITUDE_HOLD_ARM, bool)! (& Gt; L: ALTITUDE_HOLD_ARM, bool)} </ Click>
</ Area>

These buttons can be clicked together.
But I have to make a button ALT ARM that once you get to share armed automatically enters ALT HOLD
But if I press ALT HOLD sideve I disable ALT ARM.
 
Use
Code:
[code]
and
Code:
[/code ]
tags to make any gauge code display properly in your posts.
 
Please repost the XML script and use the "Code" tags. There is no way I'm going even try to read that mess...

Here is the second bit of script formatted using the "Code" tags. See how much easier it is to read? :cool:

Code:
(*  ALT ARM:  )
<Click>
(A: Autopilot master, bool)
(L: FLIGHT DIRECTOR SWITCHES, enum) 0! = ||
(L: AP_TURBULENCE_MODE, bool)! & Amp; & amp;
if {
     5 (& gt; L: l1011km_sound_id, number)
     (L: ALTITUDE_HOLD_ARM, bool)! (& Gt; L: ALTITUDE_HOLD_ARM, bool)
   }
</ Click>
</ Area>
 
I apologize. In the future when I will use post code tags.
I do not post those codes (not mine) because I really do not understand each other at all and do not know where to start to shape this part of the autopilot that controls the pitch mode.
The code with the various selectors is prontoma not know what you put in to the <value> because I do not understand the logic of the code.
This is what the autopilot to do.
Help me understand please.

15gs09f.jpg


30hx1ty.jpg


23jlglu.jpg
 
I saw the xml file of 747 by default.
The code for arming the altitude is equal to that of altitude hold.
I need two distinct:
A code that weapon the set altitude and that allows me to enter the function v \ s or hold ias climb; another code which controls the autopilot to maintain altitude.
How do I write it?
 
From the SDK:

(L:AP_PANEL_ALTITUDE_ON, bool) Turns altitude hold mode on (without capturing current altitude)
(L:AP_ALT_VAR_SET_ENGLISH, feet) Sets target altitude in feet
(L:AP_VS_VAR_SET_ENGLISH, feet per minute) Sets climb/descent rate

(L:AP_ALT_HOLD_ON, bool) Turns altitude hold mode on [and selects current altitude as the hold altitude]

Hope this helps,
 
One expression of this type as you read?

(A: "x") (L: "y", enum) 0 != || (L: "z",bool) ! &amp;&amp; if{ 5 (&gt;L: "j", number) (L: "f", bool) ! (&gt;L: "f", bool) }
 
If (A: "x") is true OR (L: "y", enum) is not equal to zero, AND (L: "z", bool) is not true then set (L: "j", number) equal to 5 and toggle (L: "f", bool) from true to false or the opposite.
 
Yes, that is precisely what that means. This is very commonly found in mouse commands to "toggle" an L:var on/off.
 
No, but the right arrow ">" symbol also is used as a flag for storing values into both (>K:commands) and (>L:variable,unit) events.

That is why most of us only use ">" for that purpose, and the multi-character & lt; and & gt; operators.

I tend to call ">" as the "goesinta" command (goes into)... :idea:
 
Let's see if I understand:

Code:
 (L:"B", number) 0 != (L:"C", enum) 0 != || (L:"D",bool) ! &amp;&amp; (L:"E", enum) 2 != &amp;&amp; 



if{ 5 (&gt;L:"H", number) (A:"F", bool) (L:"A", enum) 1 == &amp;&amp;



 if{ (&gt;K:"G", bool) 0 (&gt;L:"A", enum) (A:I, bool) ! (L:"C", enum) 0 == (A:"L",bool) &amp;&amp; &amp;&amp; if{ (&gt;K:"M",bool) } } 





 els{ (&gt;K:"N", bool) 1 (&gt;L:"O", enum) (A:"R", feet) (&gt;K:"S") } }[\code]


If (L:"B", number)is not equal to zero OR (L: "C", enum) is not equal to zero, AND (L: "D", bool) is not true AND  (L:"E", enum) is not equal to 2

then set 

(L:"H", number) equal to 5 AND (A:"F", bool) is true AND if (L:"A", enum) is equal to 1 

then set (K:"G", bool) and set (L:"A", enum) equal to 0 and ........................
too many "if" !!!!!!!
As we think in this case?
P.S. the first part is fine?
 
Back
Top