Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Inventory not working

Twine version 2.1.3 / Sugarcube 2.18.0

Hey all,
I'm trying to get an inventory to work. ANY inventory and all of the ones I've attempted, fail.

Currently trying the:
https://twinery.org/wiki/twine2:add_an_inventory_system
System as it seems the simplest.

I have:
StoryInit:
<<initInv>>

macros.initInv = {
handler: function(place, macroName, params, parser) {
state.active.variables.inventory = [];
}
};

StoryMenu:
Inventory

Inventory (passage):
Usage: <<inv>>
macros.inv = {
handler: function(place, macroName, params, parser) {
if (state.active.variables.inventory.length == 0) {
new Wikifier(place, 'nothing');
} else {
new Wikifier(place, state.active.variables.inventory.join(','));
}
}
};


<<back>>


And when I start the game, I get an error:
Error [StoryInit]: macro <<initInv>> does not exist.

I'm new to coding. VERY and don't understand the nuances of where to put macros. I've read a bunch (I think) on inventories and can't seem to get it to work.

Any advice is appreciated.

Thanks,
Z

Comments

Sign In or Register to comment.