SRL Archive - Help and Support

[Runtime Error] : Out Of Range?


hlstriker

2006-04-04 15:53:30

Hi, anytime I try to compile a script with a login array, I get this error…

[Runtime Error] : Out Of Range in line *line number* in script *path\scriptname.scar*


Any ideas why this happens?

phantombmx

2006-04-04 15:56:50

can we see the script please? its easier to find the problem if you have the source ;)

WT-Fakawi

2006-04-04 16:04:49

In your script, you are probably reffering to a non existend array number. Arrayindexes go from 0 onwards. So an array of 8 Players would be referred to as Player[0] to Player[7]

Since thePlayersArray is allocated dynamically, you need to manually setup the proper length of the Array using:
SetNumberOfPlayers(num);

hlstriker

2006-04-04 16:05:49

This happened with….

Potato Picker
http://82.92.130.193/forums/showthread.php?t=434

Goblin Scheduler
http://82.92.130.193/forums/showthread.php?t=224

Draynor Village Net Fisher
http://82.92.130.193/forums/showthread.php?t=169

hlstriker

2006-04-04 16:10:46

From: WT-Fakawi
In your script, you are probably reffering to a non existend array number. Arrayindexes go from 0 onwards. So an array of 8 Players would be referred to as Player[0] to Player[7]

Since thePlayersArray is allocated dynamically, you need to manually setup the proper length of the Array using:
SetNumberOfPlayers(num);


Well, i'm just learning how to make scripts with pascal (think that is what scar uses). I am viewing peoples source trying to find out what everything does and how it works.

While testing I just set the array number to 0.