Functions API Documentation
Saving and Reloading
Installing Narrat in a web app
Customising your Narrat game
Building and exporting your game
Example narrat script
The set function allows you to create variables that will be kept (and saved), which can later be used in conditions.
It takes two parameters:
: The path where you want to save your value. It can be a deep path and will automatically generate nested objects. For example:
: The value you want to assign to the variable. For example:
In this example, we ask the player a question, store the answer in a variable, and then use that variable in a condition to play a line of dialogue only for players who like surprises
talk cat idle "Do you like surprises?"
set DATA.like_surprises true
set DATA.like_surprises false
talk cat idle "Since you like surprises, here's a surprise message"
Result of the above code
Functions Documentation - Previous
Next - Functions Documentation