### While Loop Setup Example Source: https://docs.flightsimulator.com/html/Content_Configuration/Models/ModelBehaviors/Program_Template_Definitions.htm This example demonstrates the setup for a 'while' loop. It increments a parameter 'ID' as long as a generated parameter remains valid. Note the iteration limit of 64 unless a '' element is also specified. ```XML ID 1 1 ``` -------------------------------- ### Example Visual Effect Spawner Configuration Source: https://docs.flightsimulator.com/html/Content_Configuration/VisualEffects/Visual_Effects.htm An example demonstrating how to configure a visual effect spawner with specific parameters like GUID, spawn code, contact point, and offsets. ```XML {7E68323C-E75D-4F5B-988E-65DD4956F6BA} 1 0 > 2 1.0 90.0 ``` -------------------------------- ### Real-World Key Event Examples Source: https://docs.flightsimulator.com/html/Programming_Tools/SimVars/Simulation_Variables.htm Examples demonstrating how to trigger key events with one or two parameters. ```RPN 1 (>K:TOGGLE_EXTERNAL_POWER) ``` ```RPN 50 1 (>K:2:PANEL_LIGHTS_POWER_SETTING_SET) ``` -------------------------------- ### Advanced Checkpoint Example with Shared Variables Source: https://docs.flightsimulator.com/html/Content_Configuration/Checklists/Checklist_Examples.htm This example demonstrates a complex checkpoint setup using shared variables to control conditional execution of sequences. It initializes variables and uses them to ensure only one of two possible sequences is triggered based on simulator state. ```xml True True True ``` -------------------------------- ### Input Events (K Vars) Example Source: https://docs.flightsimulator.com/html/Programming_Tools/JavaScript/Simvar.htm Examples of initiating input events using 'K' Vars. ```APIDOC ## Input Events (K Vars) ### Description Input events are initiated using 'K' vars, prefixed with 'K:'. Some events may require an additional value. ### Example ```javascript SimVar.SetSimVarValue("K:FLAPS_INCR", "number", 0); ``` ### Example with Value ```javascript SimVar.SetSimVarValue("K:AXIS_ELEVATOR_SET", "number", -8225); ``` ``` -------------------------------- ### Complete Model XML Example Source: https://docs.flightsimulator.com/html/Content_Configuration/Models/Model_Examples.htm This is a complete example of a model's XML configuration. ```xml ``` -------------------------------- ### Spawn VFX on SimObject with Custom Parameters Source: https://docs.flightsimulator.com/html/Programming_Tools/WASM/VFX_API/fsVfxSpawnOnSimObject.htm This example demonstrates spawning a VFX on a SimObject with a specific offset and custom graph parameters. The VFX is attached to the root node, and its color is dynamically set based on the elevator deflection percentage. Ensure the VFX GUID is valid and loaded. ```c++ FsVec3d offset = { 0, 0, -5 }; FsVfxGraphParam graphParams[3]; graphParams[0].paramName = "ColorR"; graphParams[0].RPNExpression = "1"; graphParams[1].paramName = "ColorG"; graphParams[1].RPNExpression = "0"; graphParams[2].paramName = "ColorB"; graphParams[2].RPNExpression = "(A:ELEVATOR DEFLECTION PCT, Percent Over 100)"; g_SpawnVars.fxBackId = fsVfxSpawnOnSimObject("AAF9ECBE-C092-429A-877B-D41357D1E519", 0, nullptr, offset, { 0,0,0 }, -1, graphParams, 3); ``` -------------------------------- ### Example Camera and Target Names Source: https://docs.flightsimulator.com/html/Samples_And_Tutorials/Tutorials/Creating_Hanger_Showcase_RTCs.htm An example illustrating the camera and target naming convention. ```plaintext Husky_MainPanelPanorama_CAMERA Husky_MainPanelPanorama_TARGET ``` -------------------------------- ### SIMCONNECT_RECV_ENUMERATE_INPUT_EVENT_PARAMS Example 2 Source: https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/InputEvents/SimConnect_EnumerateInputEventParams.htm This example demonstrates the response structure when an instrument has multiple arguments, like a FLOAT64 and a STRING. ```plaintext SIMCONNECT_RECV_ENUMERATE_INPUT_EVENT_PARAMS: { Hash = ; Value = ";FLOAT64;char[256]" } ``` -------------------------------- ### Configure Starter Control (Default) Source: https://docs.flightsimulator.com/html/Content_Configuration/Models/ModelBehaviors/TemplateExplorer/Asobo/Common/Inputs/Electrical_Inputs.html Sets up a starter control with default parameters, including increment/decrement events and initial state handling. This is used for basic starter interactions. ```XML 2 1 1 (>K:SET_STARTER#STARTER_ID#_HELD) 1 0 #SWITCH_POSITION_TYPE# #SWITCH_POSITION_VAR# L ELECTRICAL_Starter_#STARTER_ID# @TT_Package.ELECTRICAL_PUSH_START_ACTION (#COVER_VAR_TYPE#:#COVER_VAR_NAME#) * 1 (>B:ELECTRICAL_Starter_#STARTER_ID#_Set) 0 (>B:ELECTRICAL_Starter_#STARTER_ID#_Set) p0 #COVER_CHECK# #LOWER_LIMIT# max #UPPER_LIMIT# min s0 (O:ForceHeld) if{ (>K:SET_STARTER#STARTER_ID#_HELD) } els{ (O:ForceNotHeld) if{ (>K:STARTER#STARTER_ID#_SET) } els{ #STARTER_SET_KEY# } } l0 (>#INPUTEVENT_VAR_TYPE#:#INPUTEVENT_VAR_NAME#) (A:GENERAL ENG STARTER:#STARTER_ID#, Bool) (>#INPUTEVENT_VAR_TYPE#:#INPUTEVENT_VAR_NAME#) (#INPUTEVENT_VAR_TYPE#:#INPUTEVENT_VAR_NAME#) @TT_OnOff_Cond 0 (>O:ForceHeld) 0 (>O:ForceNotHeld) (#INPUTEVENT_VAR_TYPE#:#INPUTEVENT_VAR_NAME#) p0 + (>B:ELECTRICAL_Starter_#STARTER_ID#_Set) (#INPUTEVENT_VAR_TYPE#:#INPUTEVENT_VAR_NAME#) p0 - (>B:ELECTRICAL_Starter_#STARTER_ID#_Set) #STATE0_TEST# if{ 0 (>#INPUTEVENT_VAR_TYPE#:#INPUTEVENT_VAR_NAME#) quit } #STATE1_TEST# if{ 1 (>#INPUTEVENT_VAR_TYPE#:#INPUTEVENT_VAR_NAME#) quit } #STATE2_TEST# if{ 2 (>#INPUTEVENT_VAR_TYPE#:#INPUTEVENT_VAR_NAME#) quit } p0 #LOWER_LIMIT# max #UPPER_LIMIT# min s0 (>#INPUTEVENT_VAR_TYPE#:#INPUTEVENT_VAR_NAME#) l0 0 == if{ #CODE_POS_0# quit } l0 1 == if{ #CODE_POS_1# quit } l0 2 == if{ #CODE_POS_2# quit } (#INPUTEVENT_VAR_TYPE#:#INPUTEVENT_VAR_NAME#) s0 0 == if{ (R:1:@TT_Package.GT_STATE_START) quit } l0 1 == if{ (R:1:@TT_Package.GT_STATE_ON) quit } l0 2 == if{ @TT_Off quit } LIGHT PANEL:2 ``` -------------------------------- ### Get Time Since Flight Start Source: https://docs.flightsimulator.com/html/Content_Configuration/SimObjects/Aircraft_SimO/Instruments/Panel_XML_Logic_Elements.htm Retrieves the elapsed time in seconds since the flight was started. ```XML ``` -------------------------------- ### Example LOCAL_VAR_TO_WATCH Source: https://docs.flightsimulator.com/html/Samples_And_Tutorials/Tutorials/Creating_Interactions_Using_InputEvents.htm This example demonstrates how to specify a local variable to watch for changes. The '#' should be replaced with a number starting from 0. ```xml XMLVAR_MyLocalVar ``` -------------------------------- ### Define Engine Sound Transitions Source: https://docs.flightsimulator.com/html/mergedProjects/How_To_Make_An_Aircraft/Contents/Audio/Advanced_Sound_xml.htm Specifies an audio sample to play during a change in engine state (On, Off, Start). This example plays an engine combustion start sound when transitioning from the 'Start' state to the 'On' state. ```xml ``` -------------------------------- ### SimConnect.cfg Example Configurations Source: https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/SimConnect_CFG_Definition.htm This example shows two distinct configurations for the SimConnect.cfg file, demonstrating different protocols and port settings. The index number in [SimConnect._N_] corresponds to the parameter in SimConnect_Open. ```cfg [SimConnect.0] Protocol=Pipe Port=Custom/SimConnect Address=127.0.0.1 [SimConnect.1] Protocol=Ipv6 Port=501 Address=127.0.0.1 ; Further connections here if required ``` -------------------------------- ### Example Wwise Event Naming Source: https://docs.flightsimulator.com/html/Asset_Creation/Sounds/Using_Wwise.htm Example of how to set up XML and the resulting Wwise event name for a specific sound. ```xml ``` -------------------------------- ### Starter Template - Switch Interaction Source: https://docs.flightsimulator.com/html/Content_Configuration/Models/ModelBehaviors/TemplateExplorer/Asobo/Common/Subtemplates/Electrical_Subtemplates.html Configures a starter component for 'SWITCH' interaction type. It handles covered states, uses ASOBO_GT_Switch_Covered for covered interactions, and ASOBO_GT_Push_Button for uncovered interactions. Includes Wwise events for sound. ```XML