Hi. Sorry for the probably dumb question but English is not my first language and I'm not a programmer at all.
I'm trying to use the delete Array method described here: https://www.motoslave.net/sugarcube/2/docs/object-methods.html#array-arrayprotodelete. I have a Twine2, Sugarcube 2.25 setup.
What I want is setting up a random explore system that allows the player to travel in random places, but also to remember where the player has been so that he can visit a place he knows wherever he wants, and the random explore system only brings the player to unexplored places. So, in my Storyinit file I set up an array like this:
<<set $places = ["springs", "village", "library", "mountaintop", "swamp"]>>
Then in a paragraph named "randomexplore" I put the following code:
<<if visited("VILLAGE")>>$places.delete("village") <</if>>
<<if visited("MOUNTAINTOP")>>$places.delete("mountaintop") <</if>>
<<if visited("SWAMP")>>$places.delete("swamp") <</if>>
<<if visited("SPRINGS")>>$places.delete("springs") <</if>>
<<set _randomPlaces = $places.random()>>
<<if _randomPlaces == "swamp">> You found a new place.[[SWAMP]]
<<elseif _randomPlaces == "library">>
... and so on.
The system is able to take me to one of the five random places, but it can't delete the places I actually visited. Instead it only shows the code as text, like $places.delete("library") in the middle of the paragraph without executing it. What am I doing wrong? Also, supposing it will work, after the last place has been visited, what code should I use to identify that the array is void and to let the player know he visited all of the places? Thank you in advance.