ShrikeDeCil: I would appreciate a clue on how to refer 'back' to the 'costs' line from inside the 'action' line. For example, the "10" in the ACTION_RUMOR function below should really be a function that returns the appropriate price from the 'costs' line. Sort of like a 'this.costs[2]' or 'me.costs' or something. I snipped some extraneous lines to make a shorter example, so probably non-functional as is.
new_store_action
{
define_as = "store.ACTION_RUMOR"
costs = { 15, 10, 5 }
action = function(store_info)
while not nil do
local price = 10 -- This is the price that should be read from above
if player.au < price then
message("#yYou do not have enough gold.#w")
break
else
player.au = player.au - price -- Remove gold
break
end
end
end
}
ToME Wiki