I would like to be able to reference a specific property of an object variable based on the value of another variable.
Here is a simple example of this. I was hoping that the latter <<print>> would match the former, but it doesn't, presumably because the variable is read as "$c" rather than the value of $c:
<<set $a to { b : 1 }, $c = "b">>
<<print $a.b>>
<<print $a.$c>>
I was intending to use this to implement a wardrobe system where a widget is used to change clothes.
<<widget "wardrobe">>
<<if $wardrobe.$args[0].state == 0>>
<<elseif $wardrobe.$args[0].state == 1>>
<<if $character.clothes == $args[0]>>
You are wearing the $wardrobe.$args[0].name.
<<else>>
[[$wardrobe.$args[0].name|Wardrobe][$character.clothes to $args[0]]]>>
<</if>>
<</if>>
<</widget>>
With <<widget "dress1">>, for example, finding properties of 'wardrobe.dress1'.
I can do a lengthy workaround with multiple arrays containing the names, ID's and states of the clothes separately, but that seems less elegant. Is there a way of doing it in this way?