plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.

Please take a moment to read the platform’s guidelines before you get started!

question

Mugz avatar image
Mugz asked thealx answered

Please, help to understand aircraft behaviour

Example code from TBM930 Code

<UseInputEvent ID="LIGHTING">

<KNOB_ID>Panel_Light</KNOB_ID>

<SET_STATE_EXTERNAL>

p0 0 &gt; if{

(A:LIGHT PANEL, Bool) ! (A:LIGHT PEDESTRAL, Bool) ! or if{

1 (&gt;K:PANEL_LIGHTS_SET) 1 (&gt;K:PEDESTRAL_LIGHTS_SET)

} els{

(A:LIGHT POTENTIOMETER:4, Percent) 5 &gt; if{ 4 (&gt;K:LIGHT_POTENTIOMETER_DEC) }

}

} els{

(A:LIGHT POTENTIOMETER:4, Percent) 100 == if{

0 (&gt;K:PANEL_LIGHTS_SET) 0 (&gt;K:PEDESTRAL_LIGHTS_SET)

} els{

4 (&gt;K:LIGHT_POTENTIOMETER_INC)

}

}

</SET_STATE_EXTERNAL>

<TT_VALUE>(A:LIGHT PANEL, Bool) if{ (A:LIGHT POTENTIOMETER:4, Percent) '%d%%' @sprintf } els{ (R:1:@TT_Package.GT_STATE_OFF) }</TT_VALUE>

<TT_VALUE_IS_DYNAMIC>True</TT_VALUE_IS_DYNAMIC>

<TT_DESCRIPTION_ID>@TT_Package.LIGHTING_KNOB_PANEL_ACTION</TT_DESCRIPTION_ID>

</UseInputEvent>

I dont understand:

1. p0 0 &gt; if{} - what is p0? What is contained and where does the meaning come from?

2. 4 (&gt;K:LIGHT_POTENTIOMETER_DEC) - what is mean? I send K: events four times?

3. I also not understand this: 50 0 (A:LIGHT PANEL, Bool) ? 4 (&gt;K:2:LIGHT_POTENTIOMETER_SET)

Thanks a lot for help

aircraft
10 |10000 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

1 Answer

· Write an Answer
thealx avatar image
thealx answered

1. p is stack operator - p0 will load top value. stack is a global container and values can be added outside of the current XML node (not sure about outside of the script)

2. some key events require value to be passed

3. first half is similar to common codding structure:

(A:LIGHT PANEL, Bool) == true ? 50 : 0

K:2 means 2 values will be passed - 50/0 and 4

10 |10000 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.