Arrays scripting tutorial (Page 1 of 5)

Written by Roguey,

Arrays scripting tutorial, written by Roguey

Hopefully by now I havnt confused too many of you - the loops guide was a lot more complex than just a standard single loop. Anyway.. the next thing to learn is Arrays.

Variables hold information such as text (commonly called strings), numbers or objects, however a variable can only hold one piece of information at any given time. So what do when you need something to store lots of variables at once? well.. that's when we need an array! An array can store lots of different pieces of data in one array. For example you could store the details of every station in the game in one array.

So lets make a new script to see how many ships Argon Government has. So once again make a new script (Script editor-> <New Script>), this time lets called it Count.Ships, as this script will count ships.

Hopefully but now making a new script shouldnt be a problem, however if youre confused about making a new script, then please see my Beginners scripting tutorial. As I progress with these guides, I will hope you can do more without as much explanation... heck, youre becoming a script writer now!

okay, hopefully we have a blank script ready, like so:

Our blank Count.Ships script

So what must we do to count all the Argon ships? well we need to use a command to build an array, then count how big the array is and finally report back to the player.

Next: Coding an array
Next Page >>