Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In most training scenariosScenarios, more than one script Script is used. Understanding what happens when a script Script finishes running is important because it can have an impact on other scripts Scripts that run in the scenarioScenario.

At the end of the day, there are two main choices and an option associated with each one. 

The Script Persists

A script Script will continue to run if it is not explicitly ended. This means that the script Script does not contain an End Script resourceResource. If all of the frames Frames have completed, the script Script can remain open. 

When a script Script is open, the resources Resources remain active. For a closed screen message or similar, this doesn’t mean much. However, for resources Resources used to set certain properties, spawn assets or bind scene objects to behaviour models will remain active. If the script Script is ended, those property changes will be reverted, the spawned assets will disappear and any behaviour model bindings will be undone. 

Generally, if a script Script uses Spawn Asset, Behaviour Model resourcesResources, you want the script Script to persist. Setup scripts Scripts are a good example of a script Script that should persist. They are designed to prepare the scenario Scenario and settings for other scriptsScripts.

The Script Closes

A script Script that closes contains an End Script resourceResource. This means all frames Frames in the script Script will be deactivated. 

Defined Ending Points

Having a defined end point for a script Script helps to make it reusable and modular. There are two ways to have a defined end point. Use an End Script resource Resource or use a Custom Event.

Example # 1: Spawn Assets Script

...

In the above “Spawn Assets” scriptScript, the Spawn Asset Resource is used. Therefore, we do not want to use the End Script resource Resource as the spawned assets will disappear. Therefore, we will create a Custom Event “Assets Spawned” and add it at the end of the scriptScript. We can then use that event as a Condition to open other scriptsScripts. You can see we used it here in the “Welcome” frame Frame as we don’t want the script Script to run until the Assets are Spawned:

...

This is an example of a typical script Script where an End Script resource Resource will be used to script Script an end point:

...

As you script Script in Storyflow, you may want to understand the impact of the End Script resource Resource on certain other resourcesResources. You may not be aware that the End Script resource Resource will cause the other resources Resources in the script Script to end. In this article there is a column that helps to identify this:

...