SDK docs missing/hidden info on Loop - with Param, Value and Parameters

Version: *1.6.34 SDK 1.5.7

Frequency: Consistently*

Severity: *Low
(Low - quality of life, workflow optimization, rare enough to not impact production, etc…
High - critical but workarounds are available, important feature not working as expected, frequent enough to impact production
Blocker - prevents from working on the project, prevents from releasing the product)

Marketplace package name: if applicable

Context: What package? When editing or mounted from Community? In main menu or in flight? etc…

Similar MSFS 2020 issue: insert url here if applicable

Bug description:
The parameterfn “ASOBO_Flaps_Position_Indicators_Template” has the following loop XML programming.

EDIT: perhaps a better example to explain- using the DA62 sample would be

DA62_Gear_Position_Indicators_Template

		<Loop>
			<Setup>
				<Param>NODE_ID</Param>
				<Value>CONTACT_POINT_NAME</Value>
				<Parameters>
					<LoadParameters ID="CONTACT_POINT_NAMEs"/>
					<RemoveSavedParameters ID="CONTACT_POINT_NAMEs"/>
				</Parameters>
			</Setup>
			<Do>
				<UseTemplate Name="DA62_Gear_Position_Indicator_Template">
					<CONTACT_POINT_ID>'#CONTACT_POINT_NAME#'_n</CONTACT_POINT_ID>
				</UseTemplate>
			</Do>
		</Loop>

	<Loop>
		<Setup>
			<Param>NODE_ID</Param>
			<Value>FLAPS_SETTING</Value>
			<Parameters>
				<LoadParameters ID="LIGHTS_INDICES"/>
				<RemoveSavedParameters ID="LIGHTS_INDICES"/>
			</Parameters>
		</Setup>
		<Do>
			<UseTemplate Name="ASOBO_IT_Emissive_Brightness_Template">
				<UseParametersFn Name="ASOBO_Flaps_Position_Emissive_Parameters"/>
			</UseTemplate>
		</Do>
	</Loop>

I can’t find any information on this type of loop - I am having trouble deciphering it myself.

The Param I assume is same as if it was a For Loop and each time through the loop it gets set to the Value - FLAP_SETTING. - from some other Parameters Function in the Do section.

Or is the Node_ID taken from a Flap_Setting variable?

What does the Parameters section do? It gets light indices that I assume the developer has saved somewhere. (?) possibly a non sequential list of integers?

This type of loop is not explained in the SDK docs.
Repro steps:

Attachments:

Private attachments: Send a PM to @PrivateContent with the link to this topic and the link to download your content

Anyone have any clue and can explain this to me? Stumped.

or this?

isn’t there missing _n stuff and quotes??

After a week of trying to understand this Loop structure, I think I’ve figured it out.

Like the Loop with integer iteration values, with a stop check. These Loops work without a stop check. They “Do” all the variable/values pairs listed in the Parameters part.

   <Loop>
	   <Setup>
            <Param>NODE_ID</Param>
			<Value>FLAPS_SETTING</Value>
			<Parameters>
				<LoadParameters ID="LIGHTS_INDICES"/>
				<RemoveSavedParameters ID="LIGHTS_INDICES"/>
			</Parameters>
		</Setup>
		<Do>
			<UseTemplate Name="ASOBO_IT_Emissive_Brightness_Template">
				<UseParametersFn Name="ASOBO_Flaps_Position_Emissive_Parameters"/>
			</UseTemplate>
		</Do>
	</Loop>

The Param Variable “NODE_ID” is like the loop integer iteration variable. That variable holds the tag data in the Parameters part. In this case Parameters Loads the SaveParameters from LIGHTS_INDICIES. These were set in another part.
Let’s say it contains two key/value pairs (I’ll call them)

<LIGHT_Number_R>1</LIGHT_Number_R>
<LIGHT_Number_L>2</LIGHT_Number_L>

Because there are only two parameters the iteration goes through two iterations - no more, no less. It’s kinda like an array. You loop through the array.
NODE_ID in the first iteration becomes - <NODE_ID>LIGHT_Number_R</NODE_ID>
The value of the first parameter gets posted to the <VALUE> variable, where the tag is the Value of <VALUE>. In this case FLAPS_SETTING. We then have for the First loop
<FLAPS_SETTING>1</FLAPS_SETTING>

We now have our first set of variables that are used in the “Do” part. It makes the do part look like this:

          <Parameters Type="Default">
            <NODE_ID>LIGHT_Number_R</NODE_ID>
            <FLAPS_SETTING>1</FLAPS_SETTING>
          </Parameters>
			<UseTemplate Name="ASOBO_IT_Emissive_Brightness_Template">
				<UseParametersFn Name="ASOBO_Flaps_Position_Emissive_Parameters"/>
			</UseTemplate>

If there was no Loop

ASOBO feel free to add this to the SDK Docs.(If I am correct in this explanation)

After figuring this out. I was looking at other XML programming and found “Conditional Statements”.

Then Loop with Conditional Parameters. - This is where loop parameters is explained. Still a bit confusing, but it was documented.

Please add a reference link for:

Loop with Parameters - as a third type of loop in

https://docs.flightsimulator.com/msfs2024/flighting/html/5_Content_Configuration/Models/ModelBehaviors/TemplateExplorer/Asobo_EX1/Common/Interior/Templates/ParametersFn/#Loop

and link back to

https://docs.flightsimulator.com/msfs2024/flighting/html/5_Content_Configuration/Models/ModelBehaviors/TemplateExplorer/Asobo_EX1/Common/Interior/Templates/ParametersFn/#conditional

Is this description syntactically correct?

Param is used twice and Value is used twice. I see they are different cases. Is XML programming case-sensitive?

Should it be better if described like this?

    <Loop>
        <Setup>
            <Param>PARAM_TAG</Param>
            <Value>VALUE_FOR_PARAM_TAG</Value>
            <Parameters>
                <PARAM_A>1</PARAM_A>
                <PARAM_B>2</PARAM_B>
                <PARAM_C>3</PARAM_C>
            </Parameters>
        </Setup>
        <Do>
            <#PARAM_TAG#>My ID is #VALUE_FOR_PARAM_TAG#</#PARAM_TAG#>
        </Do>
    </Loop>
</Parameters>
<!-- PARAM_A is defined with a value "My ID is 1" -->
<!-- PARAM_B is defined with a value "My ID is 2" -->
<!-- PARAM_C is defined with a value "My ID is 3" -->

Hello @DA40CGDFQ,

I tried to summarize your posts into a short list of questions and answer them one by one (I may have missed something).

Interpreting the Loop Setup/Do :
This is basically a “foreach over a parameter set” loop, different from the numeric For/While loops (there’s no explicit stop condition).
<Param> and <Value> define the two “variables” that get injected each iteration and are available inside the block.
→ I will log a ticket to add information in the doc.

Number of iterations in the Do Loop:
You’re right. The number of iterations equals the number of entries in when it’s provided.

Doors _n example :
→ I will have this reviewed

Parameters section :
If you use <SaveParameters>, you can save a list of param/value pairs, and later retrieve them elsewhere with <LoadParameters>. Think of it as a small container that stores a set of parameters under a given name/ID so it can be reused in another part of the code. <RemoveSavedParameters> lets you clean it up, in case the same name/ID is used somewhere else. I’m not sure it answer your question but there is more info in the docs about those parameters.

Regards,
Boris

I ask a bit more explanation of the param value pair as it relates to the parameters. The code I pointed out in the issue of syntax could help as it shows that param is the tag for parameters and value is the data placed between the tags. I hope I have understood how this works.

I am being so picky in this, because I hope to explain it to other devs in my YouTube tutorials. I had a hard time explaining this.

1 Like

Hello @DA40CGDFQ

This is fixed in SU5 Beta SDK 1.6.4 documentation.
Let us know if this is good for you.

Regards,
Sylvain

Thanks for the explanation here.

However the SDK docs, are not showing what you just explained as I was hoping. Plus the do loop is described and then the while loop is described compared o the do loop then the do loop is described a second time based on the while loop. “you’re in a infinite loop explanation”

I was hoping for your above explanation to make it into the Docs.

Interpreting the Loop Setup/Do :

Hello,
We updated again the documentation (SU5 flighting SDK 1.6.6.0).
Let us know if it’s good for you.

Regards,
Boris

Something went wrong with your update. Do loop description then while loop description, then do loop description with a while example.

@DA40CGDFQ

My apologies, my post above was not very clear.
I was referring to a fix included in the latest SU5 Flighting documentation 1.6.6.0.
The online documentation has not been updated yet, so the issue is still present there.

In the 1.6.6.0 you should see this :

Regards,
Boris

1 Like

This topic has been automatically closed after 60 days of inactivity since it was marked as fixed.

If there is important new information about this same report, you can use the “Request reopen” button below to ask the moderation team to review it again.
For other issues or broader discussion, please open a new topic in the appropriate category.