I'd like to make a generic shop page in Harlowe. I want to initialise it with a list of stock, then print information about the stock.
(set: $_gun to(dm: "name", "gun", "price", 150, "stock", 1))
(set: $_catapult to(dm: "name", "catapult", "price", 30, "stock", 1))
(set: $_armour to(dm: "name", "armour", "price", 50, "stock", 3))
I feel like datamaps are a good way to do this, but I'm a novice in the world of data structures.
Please browse our wares.
(set: $shoplist to (ds: "$_gun", "$_catapult", "$_armour"))
(for: each _shopitem, ...$shoplist)[(print: _shopitem's name) : £(print: _shopitem's price)]
When I use (print: $_gun's name) it works. When I try to do the same thing by looping through an array or dataset, it doesn't. :(
Thanks for any help!