Hi, I've been struggling for the past few days with creating setter buttons for my game's inventory. I need to generate buttons for each item in the inventory that set a $target variable to the value in the $i position of the $inv[ ] array. I know that due to the nature of twine's processing I'm only going to be able to set the last value, which is why I've come to you for answers on this prickly matter.
<<for $i=0; $i<$inv.length; $i++>><br><<print $inv[$i].name>>
<<if $inv[$i].hasOwnProperty('amountmax')>>
$inv[$i].amount/$inv[$i].amountmax <br>
<<button "Set Target">> <<set $target=$inv[$i]>> <</button>>
<<endif>>
<</for>>
Thank you for your time!
Comments