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

FSXA Multiple "if{" in modeldef.xml

Messages
132
Country
france
Hello,

I have some problem with multiple "if" condition on the "modeldef.xml"

I create a video to explain the bug:

http://www.youtube.com/watch?v=bNnAy0j6JSs

I don't know why the "if else" condition doesn't work. The "If" step is work, but if the "L:GNS_430_1_fqz_com_nav, bool" equal 0 the "Else" doesn't work !

The code below withou "if else" work perfect but I can't switch between COM and NAV to change frequency. :(

Code:
<CallbackCode>
	(M:Event) 'LeftSingle' scmp 0 ==
	||
	if{
	<!-- Init Position of the mouse for large Knob -->
	}
	(M:Event) 'LeftDrag' scmp 0 ==
	if{
		(L:GNS_430_1_large_left_DS,nmber) (M:Y) - 15 &gt;
		if{
			(>K:COM_RADIO_WHOLE_INC)
			(L:GNS_430_1_large_left_Knob, number) ++ (>L:GNS_430_1_large_left_Knob, number)
			<!-- Position of the mouse for large Knob -->
		} els{
		(L:GNS_430_1_large_left_DS, number) (M:Y) - -15 &lt;
		if{
			(>K:COM_RADIO_WHOLE_DEC)
			(L:GNS_430_1_large_left_Knob, number) -- (>L:GNS_430_1_large_left_Knob, number)
			<!-- Position of the mouse for large Knob -->
		}
	}
	<!-- Pourcentage calc for position of large Knob -->
	}
</CallbackCode>



See below, the section of "PartInfo" of the knob: (Some features is private and a remove with a comment)

Code:
<PartInfo>
	<Name>GNS_430_1_large_left_knob</Name>
	<AnimLength>100</AnimLength>
	<Animation>
		<Parameter>
			<Code>(L:GNS_430_1_large_left_Knob, number)</Code>
		</Parameter>
	</Animation>
	<MouseRect>
		<Cursor>Hand</Cursor>
		<TooltipText>Large left knob</TooltipText>
		<MouseFlags>LeftSingle+LeftDrag</MouseFlags>
			<CallbackCode>
				(M:Event) 'LeftSingle' scmp 0 ==
				||
				if{
				<!-- Init Position of the mouse for large Knob -->
				}
				(M:Event) 'LeftDrag' scmp 0 ==
				if{
					(L:GNS_430_1_large_left_DS,nmber) (M:Y) - 15 &gt;
					if{
						(L:GNS_430_1_fqz_com_nav, bool) == 1
							if{
								(>K:COM_RADIO_WHOLE_INC)
							}
							els{
								(>K:NAV1_RADIO_WHOLE_INC)
							}
						(L:GNS_430_1_large_left_Knob, number) ++ (>L:GNS_430_1_large_left_Knob, number)
						<!-- Position of the mouse for large Knob -->
					} els{
					(L:GNS_430_1_large_left_DS, number) (M:Y) - -15 &lt;
					if{
						(L:GNS_430_1_fqz_com_nav, bool) == 1
							if{
								(>K:COM_RADIO_WHOLE_DEC)
							}
							els{
								(>K:NAV1_RADIO_WHOLE_DEC)
							}
						(L:GNS_430_1_large_left_Knob, number) -- (>L:GNS_430_1_large_left_Knob, number)
						<!-- Position of the mouse for large Knob -->
					}
				}
				<!-- Pourcentage calc for position of large Knob -->
				}
				</CallbackCode>
		</MouseRect>
</PartInfo>

And here the code to toogle the (L:GNS_430_1_fqz_com_nav, bool) variable:

Code:
<PartInfo>
	<Name>GNS_430_1_small_left_c_v</Name>
	<MouseRect>
		<Cursor>Hand</Cursor>
		<TooltipText>C/V Button</TooltipText>
		<MouseFlags>LeftSingle</MouseFlags>
		<CallbackCode>
			(M:Event) 'LeftSingle' scmp 0 ==
				if{
					(L:GNS_430_1_fqz_com_nav, bool) ! (>L:GNS_430_1_fqz_com_nav, bool)
				}
		</CallbackCode>
	</MouseRect>
</PartInfo>

Thank you for the futur help !
 
David W. said:
See below, the section of "PartInfo" of the knob: (Some features is private and a remove with a comment)

Code:
<PartInfo>
	<Name>GNS_430_1_large_left_knob</Name>
	<AnimLength>100</AnimLength>
	<Animation>
		<Parameter>
			<Code>(L:GNS_430_1_large_left_Knob, number)</Code>
		</Parameter>
	</Animation>
	<MouseRect>
		<Cursor>Hand</Cursor>
		<TooltipText>Large left knob</TooltipText>
		<MouseFlags>LeftSingle+LeftDrag</MouseFlags>
			<CallbackCode>
				(M:Event) 'LeftSingle' scmp 0 ==
				||
				if{
				<!-- Init Position of the mouse for large Knob -->
				}
				(M:Event) 'LeftDrag' scmp 0 ==
				if{
					(L:GNS_430_1_large_left_DS,nmber) (M:Y) - 15 &gt;
					if{
						[COLOR="Red"](L:GNS_430_1_fqz_com_nav, bool) == 1[/COLOR]
							if{
						        	(>K:COM_RADIO_WHOLE_INC)
							}
							els{
								(>K:NAV1_RADIO_WHOLE_INC)
							}
						(L:GNS_430_1_large_left_Knob, number) ++ (>L:GNS_430_1_large_left_Knob, number)
						<!-- Position of the mouse for large Knob -->
					} els{
					(L:GNS_430_1_large_left_DS, number) (M:Y) - -15 &lt;
					if{
						[COLOR="Red"](L:GNS_430_1_fqz_com_nav, bool) == 1[/COLOR]
							if{
								(>K:COM_RADIO_WHOLE_DEC)
							}
							els{
								(>K:NAV1_RADIO_WHOLE_DEC)
							}
						(L:GNS_430_1_large_left_Knob, number) -- (>L:GNS_430_1_large_left_Knob, number)
						<!-- Position of the mouse for large Knob -->
					}
				}
				<!-- Pourcentage calc for position of large Knob -->
				}
				</CallbackCode>
		</MouseRect>
</PartInfo>

Thank you for the futur help !

What is highlighted in red is bad written. Should be 1 == otherwise the els{ part will never execute.

Tom
 
What the heck is the double-pipe (or condition) doing here? This may be causing a problem for you...

Code:
(M:Event) 'LeftSingle' scmp 0 ==
	[COLOR="Red"]||[/COLOR]
	if{
 
Thank Bill, I remove one | and the knobs worky perfectly ;)

You could have simply removed both of them and it would still work perfectly. The single "pipe symbol" has no meaning here at all, as it is interpreted as a "bitwise OR". This operation requires two leading parameters, so since you have only one leading parameter it is simply ignored.
 
Ok, I remove the || and now the code below work

Code:
			<CallbackCode>
				(M:Event) 'LeftSingle' scmp 0 ==
				if{
				<!-- Init Position of the mouse for large Knob -->
				}
				(M:Event) 'LeftDrag' scmp 0 ==
				if{
					(L:GNS_430_1_large_left_DS,nmber) (M:Y) - 15 &gt;
					if{
						(L:GNS_430_1_fqz_com_nav, bool) 1 ==
							if{
						        	(>K:COM_RADIO_WHOLE_INC)
							}
							els{
								(>K:NAV1_RADIO_WHOLE_INC)
							}
						(L:GNS_430_1_large_left_Knob, number) ++ (>L:GNS_430_1_large_left_Knob, number)
						<!-- Position of the mouse for large Knob -->
					} els{
					(L:GNS_430_1_large_left_DS, number) (M:Y) - -15 &lt;
					if{
						(L:GNS_430_1_fqz_com_nav, bool) 1 ==
							if{
								(>K:COM_RADIO_WHOLE_DEC)
							}
							els{
								(>K:NAV1_RADIO_WHOLE_DEC)
							}
						(L:GNS_430_1_large_left_Knob, number) -- (>L:GNS_430_1_large_left_Knob, number)
						<!-- Position of the mouse for large Knob -->
					}
				}
				<!-- Pourcentage calc for position of large Knob -->
				}
				</CallbackCode>

Thank you n4gix, I have now understood the "OR" condition ;)
 
Back
Top