Specifically, I'm trying to make a system for character stats, where a particular character's stats are stored in a datamap as strings, but can be incremented from an array. So for instance:
What I'd like to do is to be able to use $player's dex to get the string "clumsy", and then find that string's index in $dexArray so I can increment it by using
I know I can get a similar result by using numbers in the datamap (e.g. "dex", 1,) and that does make it easier to increment, but it means that each time I want to print the description of that stat, I have to use
I'm currently getting around this by using a passage I named updateVariables that I can (display:) whenever the variables change, which sets the whole
(set $player to (datamap: "dex", "clumsy", "str", "weak") ) (set $dexArray to (a: "clumsy", "average", "nimble") )
What I'd like to do is to be able to use $player's dex to get the string "clumsy", and then find that string's index in $dexArray so I can increment it by using
(set: $player's dex to $dexArray's (//index of clumsy// + 1)
I know I can get a similar result by using numbers in the datamap (e.g. "dex", 1,) and that does make it easier to increment, but it means that each time I want to print the description of that stat, I have to use
(print: $dexArray's ($player's dex))instead of a simpler
(print: $player's dex)
I'm currently getting around this by using a passage I named updateVariables that I can (display:) whenever the variables change, which sets the whole
$dexArray's ($player's dex))to a single variable $dexDesc, but it requires more prep than being able to grab the string directly from the datamap, and it means I have to call that passage any time a variable changes.