FM7 StartScript Control

From FM Plugin Wikipedia
Revision as of 21:49, 28 January 2009 by Jake (talk | contribs) (New page: The script execution order for scripts queued with the FMX_StartScript function under FM7 is incorrect. When you queue up a script with FMX_StartScript, it is always added to the end of t...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The script execution order for scripts queued with the FMX_StartScript function under FM7 is incorrect. When you queue up a script with FMX_StartScript, it is always added to the end of the script queue. When there is an actively running script at the time you call FMX_StartScript, this behaves the same exact way in all versions of FM 7 through 10. However, if there is a script that is paused at the time you call FMX_StartScript, the behavior is incorrect and will cause confusion if you don't understand what is going on.

To illustrate this, let's say we have a database with 3 scripts in it, MasterScript, PausingScript, and PluginScript. The MasterScript calls PausingScript, and PausingScript has a "Pause [Indefinitely]" in it. PluginScript is called by your plug-in while the PausingScript is paused. Depending on the "control" parameter you pass to FMX_StartScript, this is what will happen:

"Halt"
Both MasterScript and PausingScript will halt and PluginScript will run.
"Exit"
PausingScript will exit causing MasterScript to complete. PluginScript will then run after MasterScript has completed.
"Resume"
PausingScript will stop pausing and run to completion. MasterScript will then run to completion. PluginScript will then run.
"Pause"
Nothing will appear to happen at all. PausingScript will continue to be in a paused state until something else resumes it, such as pressing the "Continue" button in the Status Area. When PausingScript is continued, it will run to completion. MasterScript will run to completion. Then finally PluginScript will run.

All versions of FM 8 and up do not exhibit this behavior and work as expected, calling PluginScript before Halting, Exiting, Resuming, or Pausing the current script instead of after.