View on GitHub

smooth-script

CYOA-style scripting language for talking avatars

Variables

Variables store string, integer, floating point, or boolean data. This data can be used to customize or control the flow of the story. Variables are set with the var or function functions.

Escaping Variables

To print the contents of the variable to the screen, or to speak it with text to speech, you will need to escape the variable inside of your text or HTML. This is done with double curly brackets:

For example, the following will print “Hi there, Max”

var(name, "Max")
Hi there, {{name}}

You can also escape variables in an expression to evaluate dynamically created variable names. The following uses the rand macro to generate a random integer of 0 or 1, appending it to the “name” string to create either “name0” or “name1”, which are both valid variable names. This string is then evaluated as a variable to print “Hi there, Jack” or “Hi there, Jill” with equal probability.

var(name0, "Jack")
var(name1, "Jill")
Hi there, {{"name" + rand(2)}}

Predefined Variables

There are some variables that are always available to you: