The built in feature is called an Array Object. It lets you do a list on a 1, 2, or 3 dimensional matrix
Use an array for your list. This will let you sort, pop, delete and insert your list entries.
https://www.scirra.com/tutorials/307/ar ... -beginners
It will also let you load and save from a .json string!
In C2 the Array variable is an Object,. You cant set a global array From the event sheet, thanks littlestain!. Nor can you make an array instance variable like in Scripting languages. From the Array you can load the list into a Dictionary for additional functionality.
You can insert an arrays .JSON string, into another arrays index. This makes it possible to save all of your games arrays into a single array. This is a simple method of making a custom save game file. Makes it really easy to load too! Just one string!
I recommend the Array because it is easier to understand for people who have used real scripting languages like C#, Javascript, or Python. You can also find usable code theory on StackOverflow.com. Just substitute the Array object for the Array Variable that they are describing.
You could also do it manually with a Text object, Text instance variable, or a Dictionary object. This will require some Ninja code skills, and the knowledge of the get token at, and Token count, and making your own loop to cycle through the text. The array object has all of this built in! Not to mention the Sorting, popping, inserting and deleting.
Here is the code difference to get the word "Text":
tokenat("The,Text,From,Your,Custom,Built,String,Here"), 1, ",")[/code:yxzfx0ab]
Or just grab the second value of an array (0 base):
[code:yxzfx0ab]Array.At(1)[/code:yxzfx0ab]
Trust me, the second one is MUCH easier to debug when you are scanning over hundreds of events.
You will not have to "Cast" your values into Floats, integer or strings either. You just grab the value and run!
Here is an example of grabbing some screen locations of a game tile from a string, the INT() is me casting them from a string into an Integer:
[code:yxzfx0ab]X: int(tokenat(SliderController.Slider_Label_Offset, 0, ","))[/code:yxzfx0ab]
[code:yxzfx0ab]Y: int(tokenat(SliderController.Slider_Label_Offset, 1, ","))[/code:yxzfx0ab]
Here is what the array would look like:
[code:yxzfx0ab]X: Array.At(Array.CurX)[/code:yxzfx0ab]
[code:yxzfx0ab]X: Array.At(Array.CurY)[/code:yxzfx0ab]
Anyway, the amount of text in your expression, and casting variable back and fourth takes up valuable CPU resources. You also can NOT do complex expressions in a function like grabbing tokens, you need to have global/instance variables set for the function to be able to access them.