Hello,
I am using Twine Online, attempting to write a story in SugarCube 2.28.2. I have the following code:
This is where you create a character. Please select 3 skills from the below list.
<<set $player_skills to []>>
Your skill options are:
<<link "<span id='fightCheck'>[ ]</span> Fighting">>
<<if $player_skills.includesAny("fighting")>>
<<set $player_skills to $player_skills.delete("fighting")>>
<<replace "#fightCheck">>[ ]<</replace>>
<<else>>
<<set $player_skills to $player_skills.push("fighting")>>
<<replace "#fightCheck">>[X]<</replace>>
<</if>>
<</link>>
When run, the first click results in the replace function running, as expected. However, I am having difficulty with the array side of things in a couple of ways. The first is that the second click results in the error message below. The second is that I'm having difficulty outputting the array's contents on a second page. Not sure if it's an error in the code here or in the code on the other page, though I suspect that the issue is that the array isn't being modified by the link code above.
Error message:
Error: <<if>>: bad conditional expression in <<if>> clause:
State.variables.player_skills.includesAny is not a function.
Output code (second page):
<<print $player_skills.length>>
<<print $player_skills>>
Thanks for any help you can provide!