Finishing a Script
In most training Scenarios, more than one Script is used. Understanding what happens when a Script finishes running is important because it can have an impact on other Scripts that run in the Scenario.
At the end of the day, there are two main choices and an option associated with each one.
The Script Persists
A Script will continue to run if it is not explicitly ended. This means that the Script does not contain an End Script Resource. If all of the Frames have completed, the Script can remain open.
When a Script is open, the Resources remain active. For a closed screen message or similar, this doesn’t mean much. However, for Resources used to set certain properties, spawn assets or bind scene objects to behaviour models will remain active. If the 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 uses Spawn Asset, Behaviour Model Resources, you want the Script to persist. Setup Scripts are a good example of a Script that should persist. They are designed to prepare the Scenario and settings for other Scripts.
The Script Closes
A Script that closes contains an End Script Resource. This means all Frames in the Script will be deactivated.
Defined Ending Points
Having a defined end point for a Script helps to make it reusable and modular. There are two ways to have a defined end point. Use an End Script Resource or use a Custom Event.
Example # 1: Spawn Assets Script
In the above “Spawn Assets” Script, the Spawn Asset Resource is used. Therefore, we do not want to use the End Script Resource as the spawned assets will disappear. Therefore, we will create a Custom Event “Assets Spawned” and add it at the end of the Script. We can then use that event as a Condition to open other Scripts. You can see we used it here in the “Welcome” Frame as we don’t want the Script to run until the Assets are Spawned:
Example 2: Using an End Script Resource
This is an example of a typical Script where an End Script Resource will be used to Script an end point:
As you Script in Storyflow, you may want to understand the impact of the End Script Resource on certain other Resources. You may not be aware that the End Script Resource will cause the other Resources in the Script to end. In this article there is a column that helps to identify this: