Howdy, Stranger!

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

Help with Shop Functionality

I was trying to be clever and store a shop's inventory as an array of objects and "auto build" the store in Harlowe 2:
(if: $store_inventory's length > 0)[(for: each _item, ...($store_inventory))[(print: _item's name): $(print:_item's price)(click:_item's name)[(print: _item)(set: $item_to_purchase to _item)(goto: "Purchasing")]]]

The point was to have a purchasing screen that displayed more details about the object, and on purchase, subtract the money from the player's inventory, subtract the item from the store_inventory and add it to the player's inventory. However...

You more experienced people will immediately see the problem with my approach - the temporary variable "_item" is long gone when resolution of the click begins.

Is there a way to make something like this work?
Sign In or Register to comment.