Because it does not use a very slow, and completely unneeded, loop. Nor does it need two arrays being stored in memory.
Image what would happen if there are 10000 elements you need to index. Your script would run so slow you would think it has been froozen/crashed.
stoshrocket's script did this:
code:
1) Make a list of names:
number 1 is BlahBlah
number 2 is BooBoo
number 3 is HeyHey
2) Make a list of numbers/indexes
number 1 is 1
number 2 is 2
number 3 is 3
3) Change the list of numbers into a list of names
Check if the index is still within the bounds of the number list
if so, lookup name 1 and store it in memory
Replace index 1 with the value stored in memory
increase the index by one
Check if the index is still within the bounds of the number list
if so, lookup name 2 and store it in memory
Replace index 2 with the value stored in memory
increase the index by one
Check if the index is still within the bounds of the number list
if so, lookup name 3 and store it in memory
Replace index 3 with the value stored in memory
increase the index by one
Check if the index is still within the bounds of the number list
if so, ...., if not end the loop
4) Look up the current status
5) Get the correct name in the list of numbers.
So, even if you used an array, you can see that there is really no need for two arrays. The array in step 2 is completely useless because you already have all the names in order in the first array. Making the loop also useless. The second array is simply a list of its own indexes (an index is the number which defines an element of the array).
Matti's script does this:
code:
1) Make a list of status names, indexed and sorted by their literal numeric value: blahblah, BooBoo, HeyHey
2) Look up the current status
3) Get the correct status name in the list of statusses
Matti simply uses
Messenger.MyStatus to get the proper element directly from the list.
This is possible since the numeric values of
Messenger.MyStatus are known and always the same.
eg:
Messenger.MyStatus will always return the number 2 when you are appearing offline. So simply grab the third (counting starts at 0) element out of the predefined string list.
It's like:
You have a piece of paper showing a number
(= Messenger.MyStatus) which tells you behind what curtain your prize
(= your status strings like "offline", "online", etc) is.
stoshrocket's method:
First, construct a bunch of curtains and put some prizes behind it.
Second, construct a bunch of new doors and put a new piece of paper behind it like so:
Door 1, instructon on the new piece of paper: open curtain 1
Door 2, instructon on the new piece of paper: open curtain 2
Door 3, instructon on the new piece of paper: open curtain 3
etc..
this is the loop
Next, open the door with the number listed on your original piece of paper.
Then, open the curtain instructed on that new piece of paper you've found behind the door you've opened....
But did you notice how all those doors have the exact same number as the number in the instructions of those new pieces of paper behind each door?
Thus Matti's method:
First, construct a bunch of curtains and put some prizes behind it.
Second, directly open the curtain with the number that is on your original piece of paper....
^^ sorry for the long post, I was bored