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

'quit' for a 'limit' command?

Messages
10,163
Country
us-arizona
Hey all,

I was just going through Operators (and the like) and came accross 'quit'. I have tried this in the past, but it occurred to me, that this might cause a string to 'act once' and then cancel, to keep it from running over and over in an endless cycle.

Am I wrong?


For instance;

Code:
(A:Height from Ground,feet) 1000 <
if{
                1 (>K:TOGGLE_ENGINE1_FAILURE,bool) quit
                1 (>K:TOGGLE_ELECTRICAL_FAILURE,bool)  quit
                1 (>K:MAGNETO1_OFF) quit
                1 (>L:DEAD BATT SCREEN,bool) quit
                1 (>L:AUX Gauges POPUP, bool) quit
}

Wouldnt that kill the command string, one by one, as they 'occur' one time?
 
No, although the SDK's description of quit does seem to imply that, the critical point is that it simply stops an evaluation from continuing past the "quit"
expression operator.

pi quit (L:Running,bool)....

The quit entry forces all evaluation to stop, so the value pi is used for the rotation. The stopwatch in the preview screen should show the needle hand pointing at 30 (pi radians is 180 degrees).

The only "example" provided shows how one could use "quit" as a diagnostic tool to see what happens whenever an evaluation is "stopped" at some point.

It's another example of an otherwise useless bit of fluff in the XML schema... :rolleyes:
 
You could use it as a null operator as in;

Code:
<Value>(L:SomeVar,Bool) if{ quit } els{ do morestuff }</Value>
 
You could use it as a null operator as in;

Code:
<Value>(L:SomeVar,Bool) if{ quit } els{ do morestuff }</Value>

Even that's redundant, as this will work just as well:

Code:
<Value>(L:SomeVar,Bool) if{ } els{ do morestuff }</Value>

:rotfl::duck:

Now on the other tentacle, the "quit" token is (sometimes) useful, and one will see it used a LOT in the GPS evaluations...

Code:
<Latitude>
     (@g:currentPageWPT) 1 == if{
     (@g:currentAirportRunway) (&gt;@c:WaypointAirportCurrentRunway)
     (@c:WaypointAirportRunwayLatitude, Radians) quit }

     (@g:currentPageWPT) 3 == if{
     (@g:currentAirportApproach) (&gt;@c:WaypointAirportCurrentApproach)
     (@g:currentAirportTransition) (&gt;@c:WaypointAirportApproachCurrentTransition)
     (@c:WaypointAirportApproachTransitionLatitude, Radians) quit }
</Latitude>

In the above example, the "quit" makes perfect sense from the standpoint of "efficiency" since there are two mutually exclusive conditions. If the first evaluates as TRUE, then there's no point in even bothering to "waste time" by evaluating the second!

However, in truth one could remove "quit" entirely from the GPS500 script and the gauge would still run...

...although lot slower than it already does... :laughing:

Another example of another token that's much like an "appendix" (useless) is the ubiquitious {end} token. Although the SDK reads as though it is necessary, experience has proven that it's not...

%(CONDITIONAL)%{if}TEXT TO DISPLAY IF TRUE%{else}TEXT TO DISPLAY IF FALSE%{end}
 
Last edited:
Agree with all you say - but - from a 'coding for posterity' point of view it's nice to see that the intention was intentional and not, "he forgot to put anything between the brackets!"
 
This conversation sounds technically technical. Sophisticatedly sophisticated. Almost as though it were coded to sound otherwise..

If only quit meant quit and end meant end, but then True is 'knought' False, is it...
 
Oh Bill, you've no idea just how obtuse XML actually is!

For example:
Code:
(L:MyVar,bool)
While I suggested we can consider that this means "TRUE", technically it means "Anything except zero!" :rotfl:
 
Last edited:
I have used quit when I am testing multiple expressions, and change the value of those expressions within them. For example:

if x = 1 then x = 2 quit

if x = 2 then x = 3 quit

if x = 3 then x = 1

I know there are probably better ways to handle it, but it makes it clear to me. :)
 
I use quit frequently in mouse scripts.

For example, when a popup menu is showing the button has an entirely different function.

Code:
(L:popupmenu, bool) 1 !=
if{ ...do whatever...
    quit
}

...script for when popup isn't showing...

Many ways this could be done, just happens to one way I do it.

I think this approach started for me when I had an existing, complex script, and added a popup later. I didn't want to re-write a condition into the rest of the script.
 
Back
Top