Boundaries
Within the function bodies discussed here, you need to handle calls to the rest of the game architecture yourself. If you use the VN template the project will include several functions already defined, with the matching game architecture to match.
DIISIS itself doesn’t know what background music is. These are all systems you have to implement yourself if you don’t use a template from the project.
Exposing Scripts
DIISIS can call functions from two places: LineReaders and Autoloads, but those need to be exposed to DIISIS first. To do this, go to Setup > Functions & Variables. For more info, see Configuring Runtime Method Providers.
LineReader
Somewhere in your project, you’ll have a node that extends LineReader, which will contain the functions you want to call from within DIISIS. Conventionally, these would be fairly close to the root of your game. Enter the path to that script manually, or let DIISIS try to find it itself with the “Auto Search” button. Don’t forget to save the changes at the bottom.
Autoloads
In the Autoload tab, you can also toggle any autoloads you want to be able to access functions from. This can be used to avoid code duplication if all you’d do in your LineReader is call an autoload function.
You did it!
Once exposed, DIISIS can validate the function syntax and help with code completion!
Return types & acceding
You can make DIISIS not continue after calling a function by having that function return a boolean true. If you do, the document won’t be read further until you call Parser.function_acceded()from somewhere in your code.
Calling functions & accessing variables
Once set up, you can call functions and access variables at different points in DIISIS.
Instruction Line
An instruction line is a singular line that calls the function in its text box.
For further reading, see Instruction.
Inline Tags
There’s 3 types of tag relevant for our purposes here:
callwill call the function.funcwill call the function and insert its return value as a String in its position.varwill access the variable and insert its value as a String in its position.
If a call tag returns true, the LineReader will wait until Parser.function_acceded() has been called, just like with instruction lines. A func tag will not cause LineReader to wait and instead just insert a String "true" if you try to.
For further reading on tags, see Inline Tags.
Helpful tips
You can hold ctrl and click on any variable or function in DIISIS and Godot will pull up the respective script and place within the script, provided the script editor is open. (If you’re currently in 2D view for example, this doesn’t work)
Restrictions
Only arguments of type String, float, int, and bool are currently supported. Untyped arguments are defaulted to be Strings.