So I have some code that doesn't work, and I'm not sure why.
In theory, this code should loop through all party members and display a button saying "Delete Member" for each which, when clicked, deletes the member at that index.
However, rather than deleting the member at index $i, like it's supposed to, it deletes the member at $party.length resulting in an out-of-bounds error.
Obviously this means that $i is not being "memorized" by the print statement as it should be... Why is that? How can I fix it? I'm at a bit of a loss.
<<for $i to 0; $i < $party.length; $i++>> <<click "Delete Member">> <<print '<<set $party.deleteAt('+$i+')>>'>> <<print '<<goto "' + passage() + '">>'>> <</click>> <</for>>
In theory, this code should loop through all party members and display a button saying "Delete Member" for each which, when clicked, deletes the member at that index.
However, rather than deleting the member at index $i, like it's supposed to, it deletes the member at $party.length resulting in an out-of-bounds error.
Obviously this means that $i is not being "memorized" by the print statement as it should be... Why is that? How can I fix it? I'm at a bit of a loss.