This section explains what a Resource is, how they are triggered, what [permalink id=1904 text=’Events’] they can emit, etc.
A Resource is a command that tells the Motive engine to perform an action. They can be used to interact with the game world, to update the player’s status and Inventory, send messages to the user or to the screen, or to perform actions on Motive components ([permalink id=1843 text=’Script’], [permalink id=1846 text=’Frames’], and other Resources).
A Resource is contained within a Frame. When a Resource’s Frame is processed, that Resource will be activated. A Resource will only be activated once, unless its Frame is processed again.
In the web editor, Resources are grouped under different categories based on their functionality. When creating a Script, the Resources available for your project will be listed on the right-hand side. Some Resources contain sub-resources. A sub-resource is the same as its parent Resource, except with some of the options prepopulated. To add a Resource to a Frame, find the Resource in the Resource list, and then drag-and-drop it into the Frame Editor column in the middle, or drop it directly onto a Frame in the Frame column on the left. Alternatively you can double click a Resource to add it to the currently selected Frame.
Resources emit certain [permalink id=1904 text=’Events’] during their life-cycle. Peruse the documentation for a Resource to see what events that Resource will emit. Using a Frame Precondition, you can listen for a Resource’s Event and open Frames when the Event is triggered. These Events are emitted for all Resources:
- [permalink id=1909 text=’Activate’]: This Event is emitted when the Motive engine begins processing the container Frame for this Resource (after Preconditions satisfied)
- [permalink id=1912 text=’Deactivate’]: This Event is emitted when the Resource’s container Frame is closed. A Frame will close when the Frame’s Script has finished processing, or the Frame is explicitly closed using a [permalink id=1854 text=’Close Frame’] Resource. A Resource’s deactivate Event will also be emitted if the Resource is deactivated using a [permalink id=1856 text=’Deactivate Resource’] Resource.
You can quickly create a new Frame that listens for a certain Resource’s Event by clicking on the blue plus symbol (“+”) in the bottom-right corner of the Resource box. Choose the Event you would like to trigger a new Frame on, and the Frame will be created with the Precondition already instantiated.
Caution: When selecting a Resource Event to listen to, ensure that the Event you select is emitted by that Resource by checking the docs.
- AR Resources
- Core Resources
- Gaming Resources