Interpreter
Manages and interprets a script asset play during runtime
Last updated
Manages and interprets a script asset play during runtime
Last updated
The Interpreter object serves as a crucial component responsible for executing and interpreting the Script Asset. It acts as a bridge between the parsed script data and Unreal Engine's system.
This Actor object is spawned in world when the Play Script function is executed, and it receives the Script Asset as input, analyzes the content one statement at a time, and executes the corresponding actions in real-time. It handles tasks such as playing statements, evaluating expressions, resolving variable references, and executing commands and story flow management.
The so called bult-in functions are methods of this object's class. That's why they do not require a prefix when called in a command statement, like with methods from other objects.
The Interpreter has assignable events, related to a specific script play.
This event fires when a script statement is played.
This event fires when this script starts to play.
This event fires when this script is resumed.
This event fires when this script ends to play.
This event fires when the Manage Dialogue Box setting is off, and a Dialogue statement is played.
This event fires when the Manage Selection Box setting is off, and a set of Options statements is played.
This event fires when the Manage Background Box setting is off, and the $ Background or $ Bg built-in function is played.
This event fires when a $PlaySound audio finishes to play.
If you want to add custom behavior to your story play, script execution, statements behavior, among other things, in most cases, you need a custom Interpreter.
The Quillscript Interpreter class is designed in a way you can override, add, and modify most of its core functions, like how a dialogue plays or a script ends.
You can check which functions are overridable and what they do in the Blueprint's function override menu or in the QuillscriptInterpreter.h
header file.
To create a custom Interpreter, you need to create a Blueprint or C++ class child of AQuillscriptInterpreter
.
For Blueprints, we provide a shortcut in the content browser menu.
You can now override the required functions and add the desired behavior.
Then, in your settings change the default class, if required, to the custom Interpreter class.
The Before Methods are functions that runs before their respective flow function. This is most useful when you want to execute some tasks before a statement is played and do not want to override the base method, so you can implement these methods instead.
Before Start
Before Resume
Before Play
Before End
Before Play Label
Before Play Dialogue
Before Play Option
Before Play Command
Before Play Router
Before Play Condition
Before Play Directive