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

Defining 'OFF' with an if{

Messages
10,158
Country
us-arizona
Hey guys,

I have a question concerning switches. Lets say, I wish to write a string that says 'turn on this, and turn off that'. I have had a hard time grasping how one writes how a system is off or on. There appears to be no way of simply writing on or off aside from 'bool'.

I had toyed (tried) to use 'greater then' as a 'off' switch, thus (>A:AP_ATT_HOLD, bool) was my try at making at 'off switch'.

So... My question is, how can you define 'off'?

Lets say I wish to have VS turn off Alt Hold.
* Click Zone
* Turn off ALT if Alt is on
* Turn on Attitude Hold
! (or) (repeat?)
* Turn off Attitude Hold

I have no idea on the 'Egyptian' side of 'glyphics useage' on how one defines 'off' or even 'on' for that matter.

I guess my real issue is 'if' and the fancy brackets { } and how they are able to be used.

Also, in click zones, I see that most do not envolve using 'normal' brackets ( ) and so perhaps that is a wall I have been hitting also lately in trying to get things to illuminate on my AP panel.

I know, I could copy them and all, and I have looked around at everything, but I would like to know exactly how the on and off flags are written and why.

Many thanks for any enlightenment on the subject.

Bill

PS: Also, when would you 'not' write Repeat="Yes" in a click zone? Why wouldnt you always write it?


I know.. I am questioning the foundations of the virtual universe again.. why why why.... arrghh
 
Last edited:
Bill,

Review post #15 in

http://www.fsdeveloper.com/forum/showthread.php?t=10469

Fr. Bill may add in a few other words...

Your using a >A: when you should be using a >K:

Tack this to your monitor:

Event IDs use >K:
Simulation variables use >A: (mostly)

As to your question:

So... My question is, how can you define 'off'?

You define it as 0 or 1 - you decide then stick to it.

(L:MY VAR) 0 == if this statement is true then you use it to represent "ON" or "OFF"

I will choose the following:

When L:MY VAR is 0 then L:MY VAR is in the "OFF" condition. When L:MY VAR is 1 then it is in the "ON" condition. I use the statement (L:MY VAR) 0 == to test for "OFF" and I use (L:MYVAR) 1 == to test for "ON"

To confuse you even further I could also have used the opposite.

When L:MY VAR is 0 then L:MY VAR is in the "ON" condition. When L:MY VAR is 1 then it is in the "OFF" condition. I use the statement (L:MY VAR) 0 == to test for "ON" and I use (L:MYVAR) 1 == to test for "OFF"

0 and 1 are just bool values to "represent" a state.

Someone else should handle repeat.
 
Bill, you are really trying to make things more complicated than they need to be. What you need to do is break down what you want into separate steps, and then issue the commands in the correct sequence... ;)

The following <Click>xxx</Click> sequence will perform the first two steps you outlined.

I suspect that what you are really having the most difficulty with is coping with the rather oddball and haphazard way that ACES names the sim variables and their corresponding commands!

The script below will check to see if the Autopilot Altitude Lock is ON, and if it is, issue the command to turn it OFF.

The next step will turn on the Attitude Hold (wing level & pitch).

Note that for clarity I've left a blank line between the two steps, making it clear that they are two, separate and sequential "actions" that should occur whenever the button is "clicked> by the user.

Code:
<Click>
   // Step #1
    (A:AUTOPILOT ALTITUDE LOCK,bool) 1 == if{ (>K:AP_ALT_HOLD_OFF) }

   // Step #2
    (>K:AP_ATT_HOLD_ON)
</Click>
 
I suspect that what you are really having the most difficulty with is coping with the rather oddball and haphazard way that ACES names the sim variables and their corresponding commands!

Fr. Bill

Well, that must explain why none of my work was working since last week. I was using A: with K: Events... man.. I havent been this frustrated and depressed in ages. Good to see now why and that it is a small issue.

I had been using A: Parameters the first 4 weeks. Only last week did I start using Event ID's, and thats when things stopped working for me. Now I know.

It only made sense to me that Autopilot calls would be A: since its from the aircraft. arrghh..

Tack this to your monitor:

Event IDs use >K:
Simulation variables use >A: (mostly)

RonH

Roger that Ron and done. :cool:

Thanks for the excellent tutorial on 0 and 1 and enum. I have copied and pasted it to a txt file for backup.


Thanks guys.


Its been a rough few days. This really helps explain alot.



Bill
 
Back
Top