Storyboard scripting variables

Variables are custom aliases for other values, typically long or common strings, which can be reused elsewhere in .osb files. These cannot be changed dynamically during gameplay, meaning they are constant values. They are not supported in .osu files.


The declaration of variables occurs in a separate [Variables] section typically located at the top of the .osb file:


Variables are used in the code by typing their name (left-hand side of the declaration, including the $). For instance, with the above declarations, this:


is treated as this:



Note that while variables are preserved when saving in the beatmap editor, all instances of the variable's value are replaced with the variable. Therefore, variable values should not be too short or general, e.g.:


// ...


Saving will replace the 12s in the colour specification with $number_of_loops.