1. Lesson notes - 11.03.13
Twine- In more detail.
To set a variable in twine you use ʻsetʼ and you are able to name it as anything as long as
you put a ʻ$ʼ before it.
Silently tells the computer to use the code given, so without it the code is insufficient.
<<silently>>
<<set $name = "prompt("What's your name?")>>
<<endssilently>>
<<print $hello>> - this will allow to get get variables and print they on screen, with this
you could set up a loop to help make the game more continuos
var gold = 0; (JavaScript)
<<set $gold >> (Twine)
These two codes set variables but just in different programs, the first in JavaScript and the
second in Twine.
How to do Conditionals in Twine compared to JavaScript.
if(gold ==1){ (JavaScript)
buy the sword
}
else}
no sword for you
}
<<if $gold eq 0>>
You have no money, traveller_ (Twine)
<<else>>
You have a new sword, traveller_
<<endif>>