User Tools

Site Tools


twine2:add_an_inventory_system

Differences

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

Link to this comparison view

Next revision
Previous revision
twine2:add_an_inventory_system [2015/04/08 18:08]
nicolem created
twine2:add_an_inventory_system [2017/10/09 20:39] (current)
Line 1: Line 1:
-These macros will work in SugarCube for Twine 1.x or Twine 2.0.+=====Add an Inventory System=====
  
-[code] +These macros will work as-is in **SugarCube** for Twine 1.x or Twine 2.x. [[http://​strugglingwithtwine.blogspot.ca/​2014/​03/​handling-inventory.html|Original ​code by F2Andy]]. 
-// Begin Inventory Macros+ 
 +(If you're using another story format in Twine 1.x, you have to replace every instance of '​state.active.variables'​ in the the below code with '​state.history[0].variables'​.) 
 + 
 +They will require significant modification to work in **Harlowe** or **Snowman** on Twine 2.x. 
 + 
 +<​code>​// Begin Inventory Macros
 // Original macros by F2Andy: http://​strugglingwithtwine.blogspot.ca/​2014/​03/​handling-inventory.html // Original macros by F2Andy: http://​strugglingwithtwine.blogspot.ca/​2014/​03/​handling-inventory.html
 // //
Line 13: Line 18:
 // 2. In a passage, check if there'​s an item in the inventory.. // 2. In a passage, check if there'​s an item in the inventory..
 // ...if so, give the user a choice to progress to a new passage: // ...if so, give the user a choice to progress to a new passage:
-// <<if $inventory.indexOf("​The Golden Key"​) ​== -1>>​[[Unlock the door.]]<<​endif>>​+// <<if $inventory.indexOf("​The Golden Key"​) ​!= -1>>​[[Unlock the door.]]<<​endif>>​
 // //
 // 3. To add an "​Inventory"​ link in your sidebar menu, create a passage named "​StoryMenu"​. // 3. To add an "​Inventory"​ link in your sidebar menu, create a passage named "​StoryMenu"​.
Line 100: Line 105:
   }   }
 }; };
-// End Inventory Macros[/code]+// End Inventory Macros</code>
twine2/add_an_inventory_system.1428530936.txt.gz · Last modified: 2017/10/09 20:38 (external edit)