Did arrays get added to choicescript?


#1

I don’t know if I dreamed this, but I thought I read a blog post at one time that said we could use arrays. What I’m hoping to do is have a list of stuff like an inventory set inv = “apple, sword, raingoggles” and be able to present a choice if something exists in the array: if inv contains “apple”… Similarly, to manipulate the array if a player selects to eat the apple: remove “apple” from inv…

Is that even a function in CS, or am I thinking of something else?


#2

A short syntax for referring to variables in an array-like way has been implemented, but they aren’t true arrays. You can’t currently define them together and they don’t have any associated methods or functions.

i.e.

You can’t do *create_array …
You have to do…

*create myarray_1 "Hello"
*create myarray_2 "World"

You can then refer to them like this:

${myarray[1]} ${myarray[2]}

This is useful in loop-like constructs, but it hasn’t added any additional functionality to Choicescript, it has just made some things a lot easier (which is no bad thing, but perhaps not quite what you were hoping for).