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

MouseClick

Vitus

Resource contributor
Messages
1,480
Country
newzealand
Hi there,

I give up. Can someone please give me an example of how to create a customized MouseClick Script? I tried it like that:

Code:
      <MouseArea id="ma_smoke">
        <FloatPosition>25,243</FloatPosition>
        <Size>216,30</Size>
        <CursorType>Hand</CursorType>
        <MouseClick id="MouseClick">
          <Script>
            (A:SMOKE ENABLE,bool)!
          </Script>
          <ClickType>LeftSingle</ClickType>
        </MouseClick>
        <Tooltip id="tip_smoke">
          <DefaultScript>Smokey, smokey!</DefaultScript>
        </Tooltip>
      </MouseArea>

This code is nested in a parent MouseArea.

I have no clue. :confused:

Regards
Vitus
 
Update - but still no solution!

What I found out so far:

if I use one of the KeyEvents as described in the SDK, I can control something.
Code:
        <MouseClick id="MouseClick">
          <Script>
            1 (&gt; K:TOGGLE_MASTER_BATTERY)
          </Script>
          <ClickType>LeftSingle</ClickType>
        </MouseClick>

With this code I can trigger the master battery switch in my gauge. But a code like that:

Code:
        <MouseClick id="MouseClick">
          <Script>
            1 (&gt; A:ELECTRICAL MASTER BATTERY,bool)
          </Script>
          <ClickType>LeftSingle</ClickType>
        </MouseClick>

doesn't work at all (I know its won't trigger, just wanted to keep things simple first).
Therefore: if I want to use customized variables (e.g.: L:DO WHAT I WANT, Percent), how can I trigger or set these variables?

I really hope that there are still some people around here that can help me with my issue(s).

Regards
Vitus
 
ooooooooook, never mind. I found a way:

Code:
(L:YOU DO WHAT I WANT,bool) ! (&gt;L:YOU DO WHAT I WANT,bool)

works perfect!
 
You are confusing
"read only variables"
Code:
(A:SomeVariable,unit)

with
"command key_events"
Code:
(>K:DoSomething)

<Script> tags are only used if you are scripting a "pure FSX XML schema gauge"...
Code:
    <MouseClick id="MouseClick">
      <Script>
            (>K:TOGGLE_MASTER_BATTERY)
      </Script>
      <ClickType>LeftSingle</ClickType>
    </MouseClick>

Code:
    <MouseArea id="Small increase">
      <FloatPosition>50.000,28.000</FloatPosition>
      <Size>43,25</Size>
      <CursorType>UpArrow</CursorType>
      <MouseClick id="MouseClick">
         <Script>
            (L:DoWhatIWant, number) 0 == 
              if{  (>K:NAV1_RADIO_FRACT_INC) } 
              els{ (>K:NAV2_RADIO_FRACT_INC) }
         </Script>
      </MouseClick>
    </MouseArea>
 
Hi Bill,

You are confusing
"read only variables"
Code:
(A:SomeVariable,unit)

with
"command key_events"
Code:
(>K:DoSomething)

nononono - I know the difference between a variable and an event. My point is - or better was - how to SET variables without raising a key event.
Now, I know how to set my customized variables:
Code:
    <MouseArea id="fancy">
      <FloatPosition>0,0</FloatPosition>
      <Size>50,50</Size>
      <CursorType>Hand</CursorType>
      <MouseClick id="MouseClick">
        <Script>
          (L:IS THAT TRUE,bool) 1 ==
if { 1 (&gt;L:DO SOMETHING FANCY,bool) } 
        </Script>
        <ClickType>LeftSingle</ClickType>
        <ClickRepeat>True</ClickRepeat>
      </MouseClick>
      <Tooltip id="tip_fancy">
        <DefaultScript>Fancy, fancy</DefaultScript>
      </Tooltip>
    </MouseArea>

But one thing is still not quite clear: can I set A: variables directly if they are marked as "writeable" or do I always have to use a key event for that?

I figured out so far:
- that there is a difference between FS9 XML gauges and FSX native XML gauges. All these good tutorials (like the ones on fS2x.com) cannot be applied to a FSX gauge.
- that < and > cannot be used in the code. You have to use &gt; and &lt; instead.
- that operands are called "and" and "or" and not "AND" and "OR" (doh!)
- a lot of minor things like: put an element in an element = good; put a mousearea in an element = bad
- that backward notation sucks.

Every issue for itself can be figured out quite easily, but if you don't know any of these points your gauge will simply not work and you have no idea why ;)

Regards
Vitus
 
No. That is what Bill is saying. You cannot set A: variables in XML. Your only option is to set or toggle the event function that has a bearing on that value.

You can set your own L: variables, but not A: variables.

Si
 
ok I see. Another point where the SDK is missleading. If you look at the table of "Simulation Variables" it has a column "settable". But now I understand that it es settable only through a KeyEvent.

Thanks!
 
ok I see. Another point where the SDK is missleading. If you look at the table of "Simulation Variables" it has a column "settable". But now I understand that it es settable only through a KeyEvent.

Thanks!

They are listed as "settable" because they are...

...but only if are coding a C/C++ SimConnect plugin module!

You have to read the "fine print" to notice this though... :scratchch

Also, just to be perfectly clear, you CAN use ">" but can NOT use "<" in an XML script.

Even so, the only place I explicitly use a ">" symbol is in the command construct (>L:SomeVar,unit) or (>K:Event), and that is more for my benefit than the script's. It simply makes it easier for me to read... :)
 
Hello, I am returning to this toppic - I need a 2D gauge to "toggle" my L:var,bool - is it somehow possible? I expected it so:

Code:
<Mouse>
      <Tooltip>Pitot Heat II Switch</Tooltip>
      <Cursor Type="Hand"/>
      <Click>(>L:TOGGLE_pitotII)</Click>
</Mouse>

but it doesnt work... is it possible to toggle L:vars?

Pavel
 
Hello, I am returning to this toppic - I need a 2D gauge to "toggle" my L:var,bool - is it somehow possible? I expected it so:

Code:
<Mouse>
      <Tooltip>Pitot Heat II Switch</Tooltip>
      <Cursor Type="Hand"/>
      <Click>(>L:TOGGLE_pitotII)</Click>
</Mouse>

but it doesnt work... is it possible to toggle L:vars?

Pavel

Of course it is, but there are two requirements you've missed. All L:vars must have a ",unit" assigned, and you need to include a "toggle" mechanism:

Code:
<Click>(L:TOGGLE_pitotII,bool) ! (>L:TOGGLE_pitotII,bool)</Click>

The ! character is the "toggle" mechanism here. Every mouse click will cause the value to toggle from 0 to 1 to 0 to 1... forever. :D
 
Briliant, it works!

291755_1924247709743_1348620800_31677370_7656038_n.jpg
 
Back
Top