Returns the number of turns that have passed since the last instance of the passage with the given title occurred within the story history or -1 if it does not exist.

Warning:

Returns whether any of the given members were found within the array. The links go to the most recent release versions of each in SugarCube's source code repository.

As an example, the default replacement strings make use of this to handle various warning intros and outros. Navigation events allow the execution of JavaScript code at specific points during passage navigation. Returns the total number (count) of played turns currently in effecti.e., the number of played moments up to the present moment; future (rewound/undone) moments are not included within the total. Calling the State.prng.init() methodformerly History.initPRNG()outside of story initialization will now throw an error. There's no way for the system to know ahead of time whether it's safe to re-execute a passage's contents.

Iterates through all enumerable entries of the given collection. They are defined via the Template API. Both of these features can be constructed in SugarCube, however, using macros like <> or by combining <> macros with DOM macros.

If you need them, then you'll need to keep them out of story variables. To add a watch for a variable, type its name into the Add field and then either press enter/return or click the buttonn.b.

Returns the value of the story or temporary variable by the given name.

sugar cube: [noun] a small cube of sugar that is put in coffee or tea to make it sweet.

Opens the built-in restart dialog, prompting the player to restart the story. See the Save.onLoad.add() method for its replacement. Note: This means that some code points may span multiple code unitse.g., the character is one code point, but two code units.

Request that the browser exit fullscreen mode. For example: In general, you can group expressions into categories based on what kind of value they yield and/or what side effects they cause. Audio tracks encapsulate and provide a consistent interface to an audio resource. Note: When using Twine1/Twee, it is strongly recommended that you use only a single stylesheet tagged passage.

Due to how the Twine2 automatic passage creation feature currently works, using the link markup form will cause a passage named $return to be created that will need to be deleted.

Returns a reference to the Dialog object for chaining.

Generally, only really useful for running code that needs to manipulate elements from the incoming passage, since you must wait until they've been added to the page.

To update the value associated with a key, simply set it again. Shorthand for jQuery's .one() method applied to the audio element.

SugarCube does not trim whitespace from the contents of <>/<> macros, so that authors don't have to resort to various kludges to get whitespace where they want it.

Make sure to keep the files together if you move them out of the included directory. prerender tasks have been deprecated and should no longer be used. Returns a new array consisting of the flattened source array. This means that non-widget uses of these special variable are completely safe, though this does have the effect that uses external to widgets are inaccessible within them unless passed in as arguments.

If you click the link that sets the variable to 2, and then save the story, the $var variable will still be saved as 1, because a new moment has not yet been created. Pease, do not take your players' bandwidth and data usage lightly. Returns the moment, relative to the top of the past in-play history (past only), at the, optional, offset.

Note:

Resets the setting with the given name to its default value. Welcome to the Custom Macros for SugarCube 2 demo.

Returns whether an audio group with the given group ID exists.

See:

Does not modify the original.

There are several configuration settings for saves that it would be wise for you to familiarize yourself with. When used to set the loop state, returns a reference to the current AudioTrack instance for chaining. This setting is only used to set the version property of saves. Returns whether the autosave is available and ready. See the <