Verbs
A graph of nodes is called a Verb in Narramancer. Verb assets extend from Unity ScriptableObjects and exist as individual files within the project folder.
Verbs can also have inputs and outputs, which allow values of various types to be passed in and/or returned out.
Verbs come in two types: ValueVerbs and ActionVerbs.
Action Verbs
Verbs that perform actions over time are called ActionVerbs.
ActionVerbs have access to a category of nodes referred to as RunnableNodes.
Depending on the nodes that they are made of, an ActionVerb may execute and complete instantaneously, take several seconds or minutes, or run until the player enters some kind of input.
ActionVerbs must have exactly one RootNode, which connects to one RunnableNode and tells the verb which node to run first.
Value Verbs
Verbs that strictly get information are called ValueVerbs.
ValueVerbs don't run or execute in the same way that ActionVerbs do. They cannot use RunnableNodes, but still have access to all other basic nodes.
Verbs Within Verbs
One powerful feature of Verbs is their ability to run other verbs.
By using either the RunActionVerbNode or the RunValueVerbNode, the effects or outputs of one verb can be used within another.
NOTE: ActionVerbs can use ValueVerbs, but ValueVerbs cannot use ActionVerbs.
Creating Verbs
There are two main ways to create new Verbs:
- Right-click anywhere in the project and use the Asset Creation menu to create a new verb asset, either a ValueVerb OR an ActionVerb from under the Narramancer menu.
- Create and add an ActionVerb to a Narramancer Scene component by using the plus button and selecting ‘Create new asset’:
Running Verbs
Verbs will not run during your game unless they are attached to a NodeRunner. To attach an ActionVerb to a NodeRunner, either:
Open the Narramancer Window, navigate to the 'Verbs' tab, and add the ActionVerb to the list of 'Run At Start' verbs either by dragging and dropping the asset there or by using the plus button and selecting 'Add Existing...'
ActionVerbs in the Narramancer Window will run immediately at the start of the game.
Add the ActionVerb to a Narramancer Scene component by either dragging and dropping the asset on the 'Run On Start Verbs' list or by using the plus button and selecting 'Add Existing...'
ActionVerbs attached to a Narramancer Scene will run when the scene is loaded and started.
Verb Inputs and Outputs
Verbs can have input values and output values. Not be be confused with Node input and outpus, Verb inputs and outputs can be defined by the developer.
Input and output values are particularly useful when using ValueVerbs within other verbs: various arguments can be passed in to the ValueVerb as parameters, the logic of the ValueVerb executes, and the ValueVerb provides one or more values as outputs.
To add or edit a verb's inputs and outputs, select the verb asset and access the Inspector Window.
A Verb asset Inspector Window with Inputs and Outputs.
Use the plus button on either the input list or the output list to create an input or an output respectively. You must assign what type the input/output is and you must give it a unique name.
Outputs for ValueVerbs are assigned using OutputNodes.
An OutputNode with an output named 'Result'.
Outputs for ActionVerbs are assigned using SetVariableNodes with its scope set to Verb. Note that the node will only assign the value to the output variable when it executes.
A SetVariableNode assigning a value to the 'Result' variable.
Accessing verb input values is the same for ActionVerbs and ValueVerbs and uses a GetVariableNode with its scope set to Verb.
A GetVariableNode getting the value of the 'Result' variable.