User Tools

Site Tools


remember

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

remember [2014/09/28 14:38]
ateyourlembas
remember [2017/10/09 20:39]
Line 1: Line 1:
-<- [[function|About Functions]] --------- [[if|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. 
- 
-<​code>​ 
-At long last, you have escaped the dungeons. <<​remember $escapes += 1>> 
- 
-So far, you have escaped the dungeons <<​print $escapes>>​ times. 
-</​code>​ 
- 
-If you are only interested in remembering the current state of a variable, you don't need to include an assignment: 
- 
-<​code>​ 
-<<​remember $meals>>​ 
-</​code>​ 
- 
-If you want to reset the remembered value, you can use the <<​forget>>​ macro: 
- 
-<​code>​ 
-<<​forget $meals>>​ 
-</​code>​ 
- 
-<- [[function|About Functions]] --------- [[if|Displaying Text Conditionally]]->​ 
remember.txt ยท Last modified: 2017/10/09 20:39 (external edit)