Using: Twine 2.3.14, SugarCube 2.34.1
Been using Twine for a month now (with little prior experience in JS).
In my current project I use an array by the name of “$inventory” to keep track of what the player picks up.
The issue stems from needing to remove a single element of the $inventory array to be deleted.
I have looked through countless discussions surrounding this, but none of the solutions have worked for me.
Not sure if I am doing something wrong or if the answers are outdated.
Assuming…
$inventory = [“apple”, “apple”, “bread loaf”]
$fedFood = “apple”
<<set _foodIndex = $inventory.indexOf($fedFood)>>
<<run $inventory.deleteAt(_foodIndex)>>
With this solution the error reads “Error: <>: bad evaluation: State.variables.inventory.deleteAt is not a function”.
Thank you for your time.