From 9f6ad24c12ee7e54c8c04cecebaf4478253f0a12 Mon Sep 17 00:00:00 2001 From: Erik Ylvisaker Date: Tue, 11 Aug 2020 20:26:56 -0700 Subject: [PATCH] Documentation added for arbitrary variable names. --- docs/writing/expressions-and-variables.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/writing/expressions-and-variables.md b/docs/writing/expressions-and-variables.md index 5cb52fa..de6a39d 100644 --- a/docs/writing/expressions-and-variables.md +++ b/docs/writing/expressions-and-variables.md @@ -44,6 +44,16 @@ This sets the variable `$suspect_steve` to the number 1. If a variable hasn't been set, it will have the value `null`. +### Variable Names + +Variable names must start with a letter, and can be composed of letters, numerals and the underscore character. If this is not sufficient for your purposes, you can "escape" a variable name using backticks to supply an arbitrary variable (as long as it doesn't contain a backtick). For example: + +```yarn +Mae: Oh god. Steve Scriggins. +<> +Lori: Yeah. Him. +``` + ### Variables and your game Yarn Spinner doesn't manage the storage of information in variables itself. Instead, your game provides a *variable storage* object to Yarn Spinner before you start running dialogue. @@ -81,4 +91,4 @@ Character: You've spoken to me {$times_spoken} times today! {{}} To make your lines have correct grammar, you can use [format functions]({{}}) to select content in a line based on an expression. -{{}} \ No newline at end of file +{{}}