Hi,
I'm using Sugarcube 2, and I'm display a list of clothing that the user can choose to wear using a <<for>> loop and accessing an pre-configured array variable
eg. (formatted to aid readability)
The list displays ok, but clicking any "Wear" link acts as if the last item was clicked. This is because the reference to $csobj.name in the <<wearClothing>> macro tag is being stored as a reference, rather than the current value.
I need to somehow have <<wearClothing>> execute passing the name of the clothing item it corresponds to.
Help please?
I'm using Sugarcube 2, and I'm display a list of clothing that the user can choose to wear using a <<for>> loop and accessing an pre-configured array variable
eg. (formatted to aid readability)
<<for ...>> <<set $csobj=...>> $csobj.name <<click "Wear">> <<wearClothing $csobj.name>> <<replace "#clothing_selector">> <<display "Clothing Selector">> <</replace>> <</click>> <</for>>
The list displays ok, but clicking any "Wear" link acts as if the last item was clicked. This is because the reference to $csobj.name in the <<wearClothing>> macro tag is being stored as a reference, rather than the current value.
I need to somehow have <<wearClothing>> execute passing the name of the clothing item it corresponds to.
Help please?