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

NAV / GPS Lights Issue

Messages
10,158
Country
us-arizona
Hey guys,

Perhaps you can see what I am doing wrong. I have tried quite a number of variations and I am exhausted on idea's.

This 'should' display an active 'green lit button' when NAV is selected in Auto Pilot. When you select GPS, then the NAV button should turn off, and the GPS button should go green. Likewise, it should be turning GPS mode on and off, with off being NAV mode.

What happens presently is the NAV is continuously lit.

Here is my layout as it is presently;

ELEMENTS;

Code:
        <!--  ==========  NAV BUTTON  ============  -->

<Element Name="NAV GREEN BUTTON">
   <Position X="632" Y="27"/>
    <Visible>(L:NAV GPS SWAP, bool) 0 == ! (>L:NAV GPS SWAP, bool) 0 == </Visible>
    <Image Name="TruTrack_Green_NAV.bmp" Bright="Yes"/>      
</Element>

        <!--  ==========  GPS BUTTON  ============  -->    

<Element Name="GPS GREEN BUTTON">
  <Position X="634" Y="167"/>
   <Visible>(L:NAV GPS SWAP, bool) 1 == ! (>L:NAV GPS SWAP, bool) 1 == </Visible>
   <Image Name="TruTrack_Green_GPSS.bmp" Bright="Yes"/>      
</Element>


MOUSE CLICK ZONES;
Code:
	<!-- ====== NAV SWITCH MK-VII ====== -->

<Area Left="644" Right="698" Top="37" Bottom="67">
     <Cursor Type="Hand"/>
        (L:NAV GPS SWAP,enum) 0 == 
            if{ 
            TOGGLE_GPS_DRIVES_NAV1
              }
</Area>

	<!-- ====== GPS SWITCH MK-VII ====== -->

<Area Left="634" Right="167" Top="37" Bottom="67">
     <Cursor Type="Hand"/>
        (L:NAV GPS SWAP,enum) 1 == 
            if{ 
            TOGGLE_GPS_DRIVES_NAV1
              }
</Area>


I used this particular click code from Fr. Bills great 'multi-click zone' code; located here; http://www.fsdeveloper.com/forum/showthread.php?t=10439 (I have tried many, but today, thought I would try this approach).

On the Elements, I have tried a few variations, and none so far seem to work, only NAV is on, GPS will not illuminate.

Here are some experimental <Visible> variants I had also tried;

Code:
    <Visible>(L:NAV GPS SWAP, bool) 0 == ! (>L:NAV GPS SWAP, bool) 0 == </Visible>

    <Visible>(L:NAV GPS SWAP, bool) 0 == </Visible>


    <Visible>(L:NAV GPS SWAP,enum) 0 == 
            if{ 
            TOGGLE_GPS_DRIVES_NAV1
              }
    </Visible>


Any idea's on what I am doing wrong? Perhaps I am missing an input for autopilot and thus its not working?


Bill
 
Last edited:
Bill,

Let me jump in.

First - I have to emphasize - do not set any local variables in the <Visible> code block. The code is run just to test how the ELEMENT is to be displayed. (anyone - tell me if I am all wet here.) It is run automatically - you don't have control when it is run. On the other hand a mouse click - you have control.

So:

NAV button.
Code:
<Visible>(L:NAV GPS SWAP, bool) 0 ==</Visible>

If L:NAV GPS SWAP is 0 then visible - if L:NAV GPS is 1 then don't show element. Similar for your GPS part of the code.

if == 1 show - if == 0 then don't show.


Now in your mouse click code. Not sure if you need a value before the (>K: part.

Code:
<Area Left="644" Right="698" Top="37" Bottom="67">
     <Cursor Type="Hand"/>
        (L:NAV GPS SWAP,[COLOR="Red"]bool[/COLOR]) 0 == 
            if{ 
            [COLOR="Red"](&gt:K:[/COLOR]TOGGLE_GPS_DRIVES_NAV1)
              }
</Area>

Looks good except - try to keep the data type of your local variable the same bool or enum. One or the other. In this case it may not matter but to be safe use bool like you did in the ELEMENT code. Now what are you trying to do when the pilot clicks the mouse on the area? You want to toggle NAV1 and GPS. This is a KEY variable (does not mean a keyboard) it means you need to trigger it with the >K: part.

This code will trigger that but you also need to set your local variable to 0 or 1 also. In this case 1 because you are testing for == 0, so you must want to change to 1.

Code:
<Area Left="644" Right="698" Top="37" Bottom="67">
     <Cursor Type="Hand"/>
        (L:NAV GPS SWAP,[COLOR="Red"]bool[/COLOR]) 0 == 
            if{ 
            [COLOR="Red"](&gt:K:[/COLOR]TOGGLE_GPS_DRIVES_NAV1) 1 (&gt:L:NAV GPS SWAP, bool)
              }
</Area>

That is about as close as I can suggest - I have not tested this, but someone may need to tweak what I have shown.:D
 
Last edited:
Thanks Ron!

I see you had added bracketry to my 'TOGGLE.....' bits. Also, I had thought one always uses 'enum...' with the == 0 and 1 and so on in the click zones. My oops.

And HAPPY CANADA DAY!!!!!!!!!!!

:D

Bill
LHC
 
Last edited:
Bill,

Thanks.

You don't HAVE to use enum in certain parts of the code. A bool is a boolean data type - it is used to represent two states. either ON or OFF either YES or NO either TRUE or FALSE either 1 or 0 ...... you get the idea. We use 1 and 0 here.

An enum or enumeration means we can represent a list a values for more than two states. We can represent monday, tuesday, wednesday, thursday, friday, saturday and sunday with numbers 0,1,2,3,4,5,6 - other words monday is 0, tuesday is 1. So that instead of using costly processor time doing string comparisons like

(L:today) 'monday' scmp 0 ==

we can use

(L:today) 0 ==

just faster.

In FS SDK example an enum is 0 = OK, 1= fail, 2 = blank

for (A:PARTIAL PANEL ELECTRICAL,enum) The partial panel has more than two states it has three so an enum is used.
 
A mouse section without a <Click>xxxx</Click> is simply text. It won't do anything at all.

I thought I'd already sent you the "simple solution?" :confused:

ELEMENTS;

Code:
        <!--  ==========  NAV BUTTON  ============  -->

<Element Name="NAV GREEN BUTTON">
   <Position X="632" Y="27"/>
    <Visible>(A:GPS DRIVES NAV1) 0 ==</Visible>
    <Image Name="TruTrack_Green_NAV.bmp" Bright="Yes"/>      
</Element>

        <!--  ==========  GPS BUTTON  ============  -->    

<Element Name="GPS GREEN BUTTON">
  <Position X="634" Y="167"/>
   <Visible>(A:GPS DRIVES NAV1) 1 ==</Visible>
   <Image Name="TruTrack_Green_GPSS.bmp" Bright="Yes"/>      
</Element>


MOUSE CLICK ZONES;
Code:
	<!-- ====== NAV SWITCH MK-VII ====== -->

<Area Left="644" Right="698" Top="37" Bottom="67">
     <Cursor Type="Hand"/>
        [COLOR="Red"][B]<Click>[/B][/COLOR](>K:TOGGLE_GPS_DRIVES_NAV1)[COLOR="red"][B]</Click>[/B][/COLOR]</Area>

	<!-- ====== GPS SWITCH MK-VII ====== -->

<Area Left="634" Right="167" Top="37" Bottom="67">
     <Cursor Type="Hand"/>
        [COLOR="red"][B]<Click>[/B][/COLOR](>K:TOGGLE_GPS_DRIVES_NAV1)[COLOR="red"][B]</Click>[/B][/COLOR]</Area>
 
Last edited:
A mouse section without a <Click>xxxx</Click> is simply text. It won't do anything at all.

Fr. Bill

Arrghh.. Dang click zones.. Cant believe I missed that.. lolololol...

You did and it didnt work. I was too embarrassed to write you back, so I worked on it until I formed a mild drinking problem. Drinking problem is gone now. :eek:


Thanks Ron for the info on that. I now understand it alot better.

So, for a 'on' selection in 'calculations' style equasions where sometimes you have to have a zero in front of the brackets of a sub-section, that is the power 'going into' the equasion amount? So if there were a 1 in front of the brackets (with one that used a source figure) then that bracket sum would then be reading full amount, 1 being 100%.

I still dont know what scmp means. (slow cubic measuring pylons?) :D

Thanks guys...


Bill
 
Bill,

So, for a 'on' selection in 'calculations' style equasions where sometimes you have to have a zero in front of the brackets of a sub-section, that is the power 'going into' the equasion amount? So if there were a 1 in front of the brackets (with one that used a source figure) then that bracket sum would then be reading full amount, 1 being 100%.

Sorry Bill, if your asking me - I'm not understanding your question and terminology. Got an example?

I keep forgetting your working on FS2004 code - my examples are from the FSX SDK. scmp - is string compare.

my example above.

(L:today) 'monday' scmp 0 ==

(L:today) contains the string 'monday'

so (L:today) 'monday' scmp means compare what's in L:today variable with the string 'monday'
 
Back
Top