Twine Version: 2.35
Story Format: Sugarcube 2.33.2
Hey - I’m trying to keep my global variables relatively organised by grouping them in generic objects. I have a problem when the variables are themselves arrays.
<<set $supermarket={}>>
<<set $supermarket.pronounsIndex=0>>
<<set $supermarket.it=["It is", "You are"]>>
<span class="It">It is</span>
in the supermarket.
<<repeat 4s>>
<<if ++$supermarket.pronounsIndex>1>><<set $supermarket.pronounsIndex=0>><</if>>
<<replace ".It">><<timed 0s t8n>>$supermarket.it[$supermarket.pronounsIndex] <</timed>><</replace>>
<</repeat>>
this produces alternately:
It is, You are[1]
in the supermarket.
and
It is, You are[0]
in the supermarket.
so $supermarket.it outputs the contents of the whole array and [$supermarket.pronounsIndex] outputs the value of pronounsIndex inside square brackets. Is there a way to get the array value out like if i was working with standard arrays or do I have to abandon the $supermarket holder object?
Thanks!