Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Current »

For an overview of Resources, click here.

Overview

The End Script resource terminates the script. This can be used to prevent a script from progressing further.

Options for When a Script Finishes

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, 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 or 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 endpoint for a script helps to make it reusable and modular. There are two ways to have a defined endpoint. Use an End Script resource or use a Custom Event.

Required Fields

Field Name

Description

Status

Specifies the event emitted from this resource. This will fire
Success/Fail on any "Launch New Scripts" resources that launched this Script. It lets you manage the control flow from Director Scripts essentially.

Events

This will fire Success/Fail on any "Launch New Scripts" resources that launched this Script. It lets you manage the control flow from Director Scripts essentially. It is not necessary to use these Event Status options, but if you choose to, here is an overview:

You can see in the above example that:

  1. A script is launched within a script.

  2. In the second script, a Multiple Choice Resource is used. This resource associated a “Success” event with getting the question correct and a “Fail” event with getting the question incorrect.

  3. There are two child frames under the Multiple Choice Resource, representing the branches for Success and Fail. Both of them have an End Script Resource in them with the appropriate Status chosen from the down.

  4. In the original script, there are two branch frames. In the Condition area, the Success or Fail of the Launch Script Resource (in Step 1) is added. When the Condition is met, the Resources in this frame will fire.

Example

This resource is used often to, as mentioned, terminate the current script.

  • At the end of any script, add the End Script Resource in with a Condition that triggers it (so that it doesn’t End prematurely):

Keep in mind that most resources will also shut down once the End Script resource is used.

  • No labels