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

FS2004 XML Multiple Event IDs in One Mouserect

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
Is this possible?

I have one Inertial Separator switch and it needs to activate for both engines.

This is the visibility code for one switch that shows different textures for on switch/off switch.

<!-- inertial_seperator -->

<part>
<name>vis_sw_inertsepoff</name>
<visible_in_range>
<parameter>
<code>
(A:ENG ANTI ICE:1,bool) 0 ==
</code>
</parameter>
<minvalue>1</minvalue>
</visible_in_range>
<animation>
<parameter>
<code>
(A:ENG ANTI ICE:1,bool) if{ 50 } els{ 0 }
</code>
<lag>400</lag>
</parameter>
</animation>
<mouserect>
<cursor>Hand</cursor>
<tooltip_id>TOOLTIPTEXT_INERTIAL_SEPERATOR</tooltip_id>
<event_id>ANTI_ICE_TOGGLE_ENG1</event_id>
<event_id>ANTI_ICE_TOGGLE_ENG2</event_id>
</mouserect>
</part>

<part>
<name>vis_sw_inertsepon</name>
<visible_in_range>
<parameter>
<code>
(A:ENG ANTI ICE:1,bool) 1 ==
</code>
</parameter>
<minvalue>1</minvalue>
</visible_in_range>
<animation>
<parameter>
<code>
(A:ENG ANTI ICE:1,bool) if{ 50 } els{ 0 }
</code>
<lag>400</lag>
</parameter>
</animation>
<mouserect>
<cursor>Hand</cursor>
<tooltip_id>TOOLTIPTEXT_INERTIAL_SEPERATOR</tooltip_id>
<event_id>ANTI_ICE_TOGGLE_ENG1</event_id>
<event_id>ANTI_ICE_TOGGLE_ENG2</event_id>
</mouserect>
</part>
 
Hi Milton,

I'm not that great on coding and someone else will probably have a better response.
I would think that only one ID can be activated with one rectangle. Can you combine the code for both engines into one part?
(A:ENG ANTI ICE:1,bool) if{ 50 } else{ 0 }? Since it is Boolean will 50 work? shouldn't be 1 or 0?
 
Hi Paul, long time, no speak :-)

The reason I tried using two event_ids in one is that the magnetos are coded that way for incr/decr so it seems logical it would work.
The visibility condition switch is one of 22 and all of them work with the same coding, just different A Vars. The rocker switches (animated 0-50) light up (different texture) when On switch is displayed.

There is only one Inertial Separator XML switch in the FS9 SDK so I am trying to sort how to affect all engines with one switch. I thought multiple event_ids would do the trick.
 
Milton, you cannot use multiple <event_id> in a single mouse point. However you can use this format:

Code:
<callback_code>(>K:ANTI_ICE_TOGGLE_ENG1) (>K:ANTI_ICE_TOGGLE_ENG2)</callback_code>
 
Hello Mr. Shupe

If I understood well, you only have one switch which enables two actions. As you request, the positions for animations are:
Key 0: Off position and key 50: on position. For a twin engine aircraft; perhaps you want to try this:
HTML:
<part>
    <name>vis_sw_inertsepoff</name>
        <animation>
            <parameter>
                <code>
                    (A:ENG ANTI ICE:1,bool) 50 *
                </code>
            <lag>400</lag>
            </parameter>
        </animation>
        <mouserect>
        <cursor>Hand</cursor>
        <tooltip_id>TOOLTIPTEXT_INERTIAL_SEPERATOR</tooltip_id>
        <callback_code>
            (&gt;K:ANTI_ICE_TOGGLE_ENG1)
            (&gt;K:ANTI_ICE_TOGGLE_ENG2)
        </callback_code>
        </mouserect>
</part>

As you can see, you may add in the callback code two more engines. The case for a three engined aircraft with a single switch would be:
HTML:
<part>
    <name>vis_sw_inertsepoff</name>
        <animation>
            <parameter>
                <code>
                    (A:ENG ANTI ICE:1,bool) 50 *
                </code>
            <lag>400</lag>
            </parameter>
        </animation>
        <mouserect>
        <cursor>Hand</cursor>
        <tooltip_id>TOOLTIPTEXT_INERTIAL_SEPERATOR</tooltip_id>
        <callback_code>
            (&gt;K:ANTI_ICE_TOGGLE_ENG1)
            (&gt;K:ANTI_ICE_TOGGLE_ENG2)
            (&gt;K:ANTI_ICE_TOGGLE_ENG3)
        </callback_code>
        </mouserect>
</part>

As a side note:
The code parameter, controls the key animation states of a variable; in this case A:ENG ANTI ICE:1. Switching that variable on or off; will trigger
the other two to change its state as well. This is done in the callback code.

I hope this might be helpful.
All the best,
Sergio.
 
Thank you Sergio; you understood the problem situation perfectly. I implemented Bill's solution above (similar to yours) and the switch is now working for both engines. I appreciate your help Sergio.
 
You must be sure that both (A: ENG ANTI ICE 1, bool) and (A: ENG ANTI ICE 2, bool) have equal initial values. More secure code:
Code:
...
<code>
    (A:ENG ANTI ICE:1,bool) d
    (A:ENG ANTI ICE:2,bool) != if{ (>K:ANTI_ICE_TOGGLE_ENG2) }
    50 *
</code>
...
<callback_code>
    (A:ENG ANTI ICE:1,bool) ! d
    (>K:ANTI_ICE_SET_ENG1)
    (>K:ANTI_ICE_SET_ENG2)
</callback_code>
...
 
You must be sure that both (A: ENG ANTI ICE 1, bool) and (A: ENG ANTI ICE 2, bool) have equal initial values. More secure code:
Code:
...
<code>
    (A:ENG ANTI ICE:1,bool) d
    (A:ENG ANTI ICE:2,bool) != if{ (>K:ANTI_ICE_TOGGLE_ENG2) }
    50 *
</code>
...
<callback_code>
    (A:ENG ANTI ICE:1,bool) ! d
    (>K:ANTI_ICE_SET_ENG1)
    (>K:ANTI_ICE_SET_ENG2)
</callback_code>
...

Ah, Luka. Interesting point Sir; thank you. :-)
 
Back
Top