Info |
---|
For an overview of Resources, click here. |
Panel | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Deep Learning on Resources is found in Motive Academy. Click here to see the course this lesson is in. |
Table of Contents |
---|
Overview
The End Script resource Resource terminates the scriptScript. This can be used to prevent a script Script from progressing further.
...
Options for When a Script Finishes
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 Screen Message or similar, this doesn’t mean much. However, 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 or 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 endpoint for a script Script helps to make it reusable and modular. There are two ways to have a defined endpoint. Use an End Script resource Resource or use a Custom Event.
Required Fields
...
Field Name | Description |
---|---|
Status | Specifies the |
Event emitted from this |
Resource. This will fire |
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 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:
A script Script is launched within a scriptScript.
In the second scriptScript, 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.
There are two child frames 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.
In the original scriptScript, there are two branch framesFrames. 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 Frame will fire.
Example
This resource is used often to, as mentioned, terminate the current scriptScript.
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 Resources will also shut down once the End Script resource Resource is used.