In addition to variables you create, Chapbook also maintains a number of built-in variables called lookups. Unlike regular variables, lookups cannot be changed by you. Instead, they correspond to properties in the environment--the current date and time when the player is interacting with your story, for example, or even the story itself.
In order to leave as many variable names available to you as possible, Chapbook groups its built-in lookup variables together using objects. An objects are another type of variable--like a string, boolean, or number--that acts as a container for other variables. Unlike simple variable types like strings or numbers, objects don't have values unto themselves. They only contain other variables.
To access a variable inside an object container, enter the object's name, then a period (
.), then the variable. For instance,
story.name accesses the variable named
name inside of
You can nest objects as much as you'd like, and you can also write something like this in the vars section of a passage:
Chapbook will create each object variable (e.g.
favorite) for you if it doesn't already exist.
Below is a list of lookups that Chapbook maintains for you:
|The height of the browser window in pixels.|
|Whether the browser currently has a network connection.|
|The width of the browser window in pixels.|
|The version of Chapbook currently running, as a string.|
|A short human-readable description of the date right now.|
|The current day of the month, 1-31.|
|The hour of the time right now, where midnight is 0 and 11:00 PM is 23.|
|The minute of the time right now, 0-59.|
|The current month, 1-12.|
|The name of the current month.|
|The second of the time right now, 0-59.|
|A short human-readable description of the time right now.|
|The current day of the week, where Sunday is 1, Wednesday is 4, and Saturday is 7.|
|The name of the current day of the week.|
|The current four-digit year.|
|The name of the current passage as set in the Twine editor.|
|The number of times the player has seen the current passage, including the current time. That is, the first time the player sees a passage, this lookup's value is 1.||1|
|The name of the story as set in the Twine editor.|
now lookup values reflect when they were last accessed, which is usually when a passage is navigated to. String values like
now.monthName will vary by the language the player has set as default in their browser-- a French person will see
Août where an American sees
August, for example, and similarly the French will see
'15/2/2011' where Americans see it as