Macros are built-in functions that perform some common tasks. Below is a list of some common macros that you can use at any stage in your CSML flows.
Return one the elements of the array passed in the first argument at random.
Useful for randomisation of dialogue parts!
say OneOf(["I like you", "You're awesome"])
Given an array, return it with its elements in a random order.
Especially useful in questions to randomize the available options!
do btn1 = Button("Blue")do btn2 = Button("Red")do btns = huffle([btn1, btn2])say Question(title = "Select a pill",buttons = btns)
Return whether a string is contained in another string.
say Find("needle", in="haystack") // falsesay Find("yes", in="well yes, I like cheese") // true
Return the length of a given string or array
say Length("My horse is amazing") // 19say Length([1, 2, 3]) // 3