-
Notifications
You must be signed in to change notification settings - Fork 1
Accessing functions and variables in DIISIS
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 a background music is. These are all systems you have to implement yourself if you don't use a template from the project.
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.
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.

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.

Once exposed, DIISIS can validate the function syntax and help with code completion!

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.
Once set up, you can call functions and access variables at different points in DIISIS.
An instruction line is a singular line that calls the function in its text box.

For further reading, see here.
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 here
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)
Only arguments of type String, float, int, and bool are currently supported. Untyped arguments are defaulted to be Strings.



💖Make visual novels with DIISIS
- ⧋Getting Started▽
- [VN Template Tutorials]
📈Getting Started
- High Level Overview
- Line Types
- Text
- Choice
- Instruction
- Folder
- Editor Overview
- LineReader & Parser
💥Interactivity and Reactivity
🧠 More Knowledge
- Upgrading to a new version
- Shortcuts
- Dropdowns
- Header
- Text Ingestion
- Adding argument restrictions to functions