Seeded Parameters for every script/scriptlet
- Plugin fetch the script code and inject “seeded parameters”, some of them will be empty, depends on the stage when it was called, example: “mxGoalName" will have "goal1" as value while "mxCurrentTrigger" will be empty since there is no trigger evaluated right now.
These parameters indicate from where the script was originated.But there is an easier way, as I stated in my previous message, It is always best to name a script with the desired function name in mind(*), example format: “script1.func1”.
The plugin will call the script “script1” and will send the parameter “mxFuncCall” with the value “func1”.
(*) Exception when you call scriplet code. These are very short (probably one liner) of code embedded inside the XML mission file.
- Once parameters were seeded, the plugin execute the “embedded script”.
- The embedded script can use the “seeded” parameters (in red) to locate the needed code and execute it. If we use the format: “script.function” then we can easily manage our script by writing:
if (mxFuncCall = ”func1”) then
The script can also call specialized functions from the plugin and set variables for later use, but only in the plugin side, parameters on the script side will lose scope (erased) after script finish execution.
What we should write in the script files ?
The script is first and foremost to allow the designer write simple logic on DATAREF information, and make decisions based on their values.
Actions that should be implemented in the scripts are:
- Abort mission.
- Send communication like message/s to simmer.
- Send 3D messages (text messages on the top right hand of the screen).
- Force rules.
- Simulate simple scenarios on plane systems.
- And others.
Currently not all of these actions are supported, but I believe they will be in the near future.
Please remember - code must be short and to the point. Bad code can stop X-Plane or hurt performance.