User Tools

Site Tools


This is an old revision of the document!

About Functions ——— Displaying Text Conditionally

<<remember>> and <<forget>>

Motivating example

Variables are reset every time the reader restarts a story. If you'd like to remember the value of a variable after the game, use the <<remember>> macro. It works exactly the same way as <<set>>, except it stores the variable in browser storage that remains between sessions.

At long last, you have escaped the dungeons. <<remember $escapes += 1>>

So far, you have escaped the dungeons <<print $escapes>> times.

If you are only interested in remembering the current state of a variable, you don't need to include an assignment:

<<remember $meals>>

If you want to reset the remembered value, you can use the «forget» macro:

<<forget $meals>>

About Functions ——— Displaying Text Conditionally

remember.1411929503.txt.gz · Last modified: 2017/10/09 20:37 (external edit)