Hello
hope you will understand me, i 'm french teacher not so good in english
i just start twine. Not so good in programs but motivated.
Want to use it with my students ( 11 years old childs )
To be fun i will let them write but want to make a fun system.
i want to introduce simple rules.
in forums i took :
<<set $inv = ["Dagger", "Shield", "Potion"] >>
for exemple, to start an inventory
<<set $inv.remove('Potion')>>
and a script with to remove a potion for exemple from the inventory
and the way to print the inventory
<<print $inv.join("\n")>>
i don't write all but it s OK
In a passage if i want them to find a new object to add to the inventory
i ve done it with :
<<set $inv.push("new object")>>
it s ok with
<<print $inv.join("\n")>>
new object appear
BUT each time i go to the passage the new object come again in my inventory
how to make it appear just once ??
or with a message : you have already that object ?
Thank's and sorry for my poor english
Comments
To check if an array $variable contains a value you can use SugarCube's contains function. So if you want add "new object" to your $inv variable only once you could do the following: ... or if you want to show a message instead:
Thank you