Saving and loading
You can allow players to save the game at any moment and to load it – in the same way as in any typical computer game. In order to do it, use the specially developed (save-game: )
macro and the (load-game: )
macro.
Select a place and insert a saving link:(link: "Save the game")[(save-game: "file A")]
Select a place and insert a loading link:(link: "Load the game")[(load-game: "file A")]
When players click the “Save the game” link, the game will be saved in the “A file” in the browser and the text of the link will disappear. When the game is loaded, players will find themselves at the moment in which they saved the game previously.
When players try to load fragments of the game which were not saved before (players did not click the “Save the game” link but they just went on to the next parts of the story), you can use the IF conditional instruction, to be on the safe side. If a particular fragment of the game has been saved in the A file, display the game loading link, otherwise do not display it.
{
(if: (saved-games:) contains "file A")
[(link: "Load the game")[(load-game: "file A")]]
}
Repeating words
(str-repeated: 5, "Hello! ")
you will get: Hello! Hello! Hello! Hello! Hello!
Reversing words
(str-reversed: "Hello!")
you will get: !olleH
The date/time macros
If, in your story, you need to use the current date or time loaded from players’ devices, use the macros given in the following example.
Example
Current date: (current-date:)
Current time: (current-time:)
Current month day: (monthday:)
Current weekday: (weekday:)
Result
The (live: )
macro
The (live: )
macro allows you to wait for a particular period of time (given in seconds) and, for example, to run another macro or just to display a text.
Recurrence
Remember that if you use the (live: )
macro to run another macro every now and then or to display a text, it will be repeated indefinitely, in a particular time interval, for example: select a word from the word list every 2 seconds.
Automatic undo
You can combine the (live: )
macro and the (undo: )
macro in order to return automatically from the second slip to the first slip after a particular time, given in seconds; for example: (live: 2s)[(undo:)]
The START slip
## (live: 0.5s)[(either: "Bang!", "Kaboom!", "Whammo!", "Pow!")]
(live: 2s)[Plain text 1.(stop:)]
(live: 3s)[Plain text 2.(stop:)]
(live: 4s)[Plain text 3.(stop:)]
[[mystery]]
The MYSTERY slip
Horrible mystery
(live: 2s)[(undo:)]
Result – you can test:
The (event: )
macro
If you want a text, a link, a macro, etc. to be displayed after a particular period of time (without its cyclical repetition – the macro will be run only once), use the (event: )
macro.
Example
(event: when time > 3s)[Oh, no! I wanted to tell you about a [[mystery]]]
Result
After 3 seconds a hidden text will appear with a link:
The (transition: )
macro
The (transition: )
macro allows you to highlight a selected text just after a particular slip (a fragment of the story) is accessed. For example, you go from the START slip to the ADVENTURE slip. As soon as you go to the ADVENTURE slip, the first task is animated for 1s.
Example
(t8n: "instant")[Plain text 1 - instant].
(t8n: "dissolve")[Plain text 2 - dissolve]
(t8n: "flicker")[Plain text 3 - flicker]
(t8n: "shudder")[Plain text 4 - shudder]
(t8n: "rumble")[Plain text 5 - rumble]
(t8n: "slide-right")[Plain text 6 - slide-right]
(t8n: "slide-left")[Plain text 7 - slide-left]
(t8n: "pulse")[Plain text 8 - pulse]
Result – you can test: