Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Array Size Limits? (https://forums.graalonline.com/forums/showthread.php?t=58285)

jake13jake 03-26-2005 10:18 PM

Array Size Limits?
 
Nightmareangel, the GC Admin on Classic, recently asked me to fix a script for him. The script changes tiles in the level. I ran through it, and found out that it broke when it hit the tile array. I did a little bit of meticulous testing and found that the array would work only to 254 numbers. I was wondering whether or not this was constant. It would be nice to know if there were alternative means to scripting this, too, like having the array in a text file on the server and then having the script read tokens from the text file instead of an array.

It would also be nice to have some suggestions on how to deal with this limitation, because I'm currently working on a tile editor script that has clipboard and tolerance options. Any ideas would be appreciated.

Lance 03-26-2005 10:21 PM

Quote:

Originally Posted by jake13jake
It would also be nice to have some suggestions on how to deal with this limitation, because I'm currently working on a tile editor script that has clipboard and tolerance options. Any ideas would be appreciated.

Perhaps use two (or more) arrays?

Admins 03-26-2005 10:41 PM

The max array size is 10000 like for most things

Polo 03-27-2005 12:09 AM

For standard 'setarray' arrays, I've used upwards of 1000 without any side effects...

jake13jake 03-27-2005 01:49 AM

hmmm... do you think it could be because evil put hex code in the array?
NPC Code:

this.tiles_01 = {
0xBA,0xB9,0xBA,0xB9,0xBA,0xB9,0xBA,0xBB,0xCB,0x88B ,0x88B,0x88B,0x88B,0x88B,0xB8,0xB9,0xBA,0xBB,0x88B ,0x88B,0x88B,0x88B,0xB8,0xB9,0xBA,0xB9,0xBA,0xB9,0 xBA,0xBB,0xB8,0xB9,0xBA,0xBB,0xB8,0xB9,0xBA,0xB9,0 xBA,0xB9,0xBA,0xBB,0x88B,0x88B,0x88B,0xB8,0xB9,0xB A,0xBB,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0xC8,0x B8,0xB9,0xBA,0xB9,0xBA,0xB9,0xBA,0xB9,
0xB9,0xBA,0xB9,0xBA,0xB9,0xBA,0xBB,0xCB,0x88B,0x88 B,0x88B,0x88B,0x88B,0x88B,0xC8,0xC9,0xCA,0xCB,0x88 B,0x88B,0x88B,0x88B,0xC8,0xC9,0xCA,0xC9,0xCA,0xC9, 0xCA,0xCB,0xC8,0xC9,0xCA,0xCB,0xC8,0xC9,0xCA,0xC9, 0xCA,0xC9,0xCA,0xCB,0x88B,0x88B,0x88B,0xC8,0xC9,0x CA,0xCB,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B, 0xC8,0xB8,0xB9,0xBA,0xB9,0xBA,0xB9,0xBA,
0xC9,0xCA,0xC9,0xCA,0xC9,0xCA,0xCB,0x88B,0x88B,0x8 8B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A,0x277,0x88B ,0x88B,0x88B,0x88B,0x88B,0x88B,0xD9,0xDA,0xD9,0xDA ,0xD9,0xDA,0x88B,0x88B,0x27A,0x277,0x88B,0x88B,0xD 9,0xDA,0xD9,0xDA,0xD9,0xDA,0x88B,0x88B,0x88B,0x88B ,0x88B,0x27A,0x277,0x88B,0x88B,0x88B,0x88B,0x88B,0 x88B,0x88B,0x88B,0x88B,0xC8,0xC9,0xCA,0xC9,0xCA,0x C9,0xCA,
0xD9,0xDA,0xD9,0xDA,0xD9,0xDA,0x88B,0x88B,0x88B,0x 88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A,0x287,0x88 B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0xEA,0 xE9,0x88B,0x88B,0x88B,0x88B,0x28A,0x287,0x88B,0x88 B,0x88B,0x88B,0xEA,0xE9,0x88B,0x88B,0x88B,0x88B,0x 88B,0x88B,0x88B,0x28A,0x287,0x88B,0x88B,0x88B,0x88 B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0xD9,0xDA,0x D9,0xDA,0xD9,0xDA,
0xE9,0xEA,0xE9,0xEA,0xE9,0x287,0x88B,0x88B,0x88B,0 x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A,0x277,0x8 8B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A ,0x277,0x88B,0x88B,0x88B,0x88B,0x27A,0x277,0x88B,0 x88B,0x88B,0x88B,0x27A,0x277,0x88B,0x88B,0x88B,0x8 8B,0x88B,0x88B,0x88B,0x27A,0x277,0x88B,0x88B,0x88B ,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A,0 xEA,0xE9,0xEA,0xE9,0xEA,
0xD9,0xDA,0xD9,0xDA,0xD9,0x277,0x88B,0x88B,0x88B,0 x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A,0x287,0x8 8B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A ,0x287,0x88B,0x88B,0x88B,0x88B,0x28A,0x287,0x88B,0 x88B,0x88B,0x88B,0x28A,0x287,0x88B,0x88B,0x88B,0x8 8B,0x88B,0x88B,0x88B,0x28A,0x287,0x88B,0x88B,0x88B ,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A,0 xDA,0xD9,0xDA,0xD9,0xDA,
0xE9,0xEA,0xE9,0xEA,0xE9,0x287,0x88B,0x88B,0x88B,0 x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A,0x277,0x8 8B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A ,0x277,0x88B,0x88B,0x88B,0x88B,0x27A,0x277,0x88B,0 x88B,0x88B,0x88B,0x27A,0x277,0x88B,0x88B,0x88B,0x8 8B,0x88B,0x88B,0x88B,0x27A,0x277,0x88B,0x88B,0x88B ,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A,0 xEA,0xE9,0xEA,0xE9,0xEA,
0xD9,0xDA,0xD9,0xDA,0xD9,0x277,0x88B,0x88B,0x88B,0 x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A,0x287,0x8 8B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A ,0x287,0x88B,0x88B,0x88B,0x88B,0x28A,0x287,0x88B,0 x88B,0x88B,0x88B,0x28A,0x287,0x88B,0x88B,0x88B,0x8 8B,0x88B,0x88B,0x88B,0x28A,0x287,0x88B,0x88B,0x88B ,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A,0 xDA,0xD9,0xDA,0xD9,0xDA,
0xE9,0xEA,0xE9,0xEA,0xE9,0x287,0x88B,0x88B,0x88B,0 x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A,0x277,0x8 8B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A ,0x277,0x88B,0x88B,0x88B,0x88B,0x27A,0x277,0x88B,0 x88B,0x88B,0x88B,0x27A,0x277,0x88B,0x88B,0x88B,0x8 8B,0x88B,0x88B,0x88B,0x27A,0x277,0x88B,0x88B,0x88B ,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A,0 xEA,0xE9,0xEA,0xE9,0xEA,
0xD9,0xDA,0xD9,0xDA,0xD9,0x277,0x88B,0x88B,0x88B,0 x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A,0x287,0x8 8B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A ,0x287,0x88B,0x88B,0x88B,0x88B,0x28A,0x287,0x88B,0 x88B,0x88B,0x88B,0x28A,0x287,0x88B,0x88B,0x88B,0x8 8B,0x88B,0x88B,0x88B,0x28A,0x287,0x88B,0x88B,0x88B ,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A,0 xDA,0xD9,0xDA,0xD9,0xDA,
0xE9,0xEA,0xE9,0xEA,0xE9,0x287,0x88B,0x88B,0x88B,0 x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A,0x277,0x8 8B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A ,0x277,0x88B,0x88B,0x88B,0x88B,0x27A,0x277,0x88B,0 x88B,0x88B,0x88B,0x27A,0x277,0x88B,0x88B,0x88B,0x8 8B,0x88B,0x88B,0x88B,0x27A,0x277,0x88B,0x88B,0x88B ,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A,0 xEA,0xE9,0xEA,0xE9,0xEA,
0xD9,0xDA,0xD9,0xDA,0xD9,0x277,0x88B,0x88B,0x88B,0 x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A,0x287,0x8 8B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A ,0x287,0x88B,0x88B,0x88B,0x88B,0x28A,0x287,0x88B,0 x88B,0x88B,0x88B,0x28A,0x287,0x88B,0x88B,0x88B,0x8 8B,0x88B,0x88B,0x88B,0x28A,0x287,0x88B,0x88B,0x88B ,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A,0 xDA,0xD9,0xDA,0xD9,0xDA,
0xE9,0xEA,0xE9,0xEA,0xE9,0x287,0x88B,0x88B,0x88B,0 x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A,0x277,0x8 8B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x27A ,0x277,0x88B,0x88B,0x88B,0x88B,0x27A,0x277,0x88B,0 x88B,0x88B,0x88B,0x27A,0x277,0x88B,0x88B,0x88B,0x8 8B,0x88B,0x88B,0x88B,0x27A,0x277,0x88B,0x88B,0x88B ,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x88B,0x28A,0 xEA,0xE9,0xEA,0xE9,0xEA,
0xD9,0xDA,0xD9,0xDA,0xD9,0x277,0x88C,0x88B,0x88B,0 x88C,0x88C,0x88B,0x88C,0x88C,0x88B,0x28A,0x287,0x8 8B,0x88C,0x88B,0x88B,0x88C,0x88B,0x88B,0x88C,0x28A ,0x88C,0x88C,0x88B,0x88C,0x88B,0x28A,0x287,0x88B,0 x88C,0x88B,0x88C,0x28A,0x287,0x88B,0x88C,0x88C,0x8 8B,0x88C,0x88C,0x88C,0x28A,0x287,0x88C,0x88B,0x88B ,0x88C,0x88C,0x88B,0x88C,0x88B,0x88C,0x88C,0x27A,0 xDA,0xD9,0xDA,0xD9,0xDA,
0xE9,0xEA,0xE9,0xEA,0xE9,0x287,0x844,0x88C,0x88C,0 x844,0x62F,0x88C,0x844,0x62F,0x88C,0x27A,0x88C,0x8 8C,0x844,0x88C,0x88C,0x844,0x88C,0x88C,0x62F,0x27A ,0x62F,0x62F,0x88C,0x62F,0x88C,0x27A,0x277,0x88C,0 x62F,0x88C,0x62F,0x844,0x277,0x88C,0x62F,0x62F,0x8 8C,0x62F,0x844,0x62F,0x844,0x277,0x844,0x88C,0x88C ,0x844,0x844,0x88C,0x62F,0x88C,0x844,0x844,0x28A,0 xEA,0xE9,0xEA,0xE9,0xEA,
0xD9,0xDA,0xD9,0xDA,0xD9,0x277,0x844,0x62F,0x844,0 x62F,0x62F,0x844,0x844,0x62F,0x844,0x28A,0x62F,0x8 44,0x62F,0x844,0x62F,0x62F,0x844,0x844,0x62F,0x844 ,0x62F,0x62F,0x844,0x62F,0x844,0x7FF,0x7FF,0x844,0 x63F,0x62F,0x844,0x62F,0x844,0x62F,0x844,0x62F,0x6 2F,0x844,0x62F,0x844,0x62F,0x844,0x62F,0x844,0x62F ,0x62F,0x844,0x62F,0x844,0x844,0x62F,0x844,0x27A,0 xDA,0xD9,0xDA,0xD9,0xDA,
0xE9,0xEA,0xE9,0xEA,0xE9,0x287,0x62F,0x63F,0x62F,0 x63F,0x63F,0x62F,0x62F,0x63F,0x62F,0x844,0x62F,0x6 2F,0x63F,0x62F,0x63F,0x63F,0x62F,0x62F,0x63F,0x62F ,0x62F,0x568,0x569,0x63F,0x62F,0x8F,0x82,0x62F,0x8 F,0x63F,0x62F,0x62F,0x62F,0x63F,0x62F,0x63F,0x63F, 0x62F,0x63F,0x62F,0x62F,0x62F,0x63F,0x62F,0x63F,0x 63F,0x62F,0x63F,0x62F,0x62F,0x62F,0x62F,0x28A,0xEA ,0xE9,0xEA,0xE9,0xEA,
0xF9,0xFA,0xF9,0xFA,0xF9,0x297,0x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,0x8DC,0x8DC,0x8DC,0x82,0x1FF,0x7FF, 0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0xAC0,0x82,0x1 FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0xAC0 ,0x82,0x1FF,0x1FF,0x1FF,0x1FF,0xAC0,0x82,0x1FF,0x1 FF,0x1FF,0x1FF,0xAC0,0x82,0x1FF,0x1FF,0x1FF,0x1FF, 0x1FF,0x1FF,0x1FF,0xAC0,0x82,0x1FF,0x7FF,0x7FF,0x1 FF,0x1FF,0x7FF,0x1FF,0x7FF,0x7FF,0xAC0,0xD2,0xD3,0 xD4,0xD5,0x1FF,0x1FF,
0xAF,0xAE,0xDD,0x121,0x122,0x123,0x82,0x7FF,0x1FF, 0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0xAC0,0x82,0x1 FF,0x1FF,0x1FF,0x7FF,0x1FF,0x1FF,0x1FF,0x1FF,0xAC0 ,0x82,0x1FF,0x7FF,0x1FF,0x7FF,0xAC0,0x82,0x1FF,0x1 FF,0x1FF,0x1FF,0xAC0,0x82,0x7FF,0x1FF,0x1FF,0x1FF, 0x1FF,0x1FF,0x1FF,0xAC0,0x82,0x1FF,0x1FF,0x1FF,0x1 FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0xAC0,0xE2,0xE3,0 xE4,0xD5,0x1FF,0x1FF
};


I actually trimmed the spaces to see if that would help. I've noticed that leading zeros can sometimes break an array, too.

NPC Code:

this.colorselect = {
132, 000, 000,
206, 024, 041,
255, 000, 000,
255, 132, 132,
255, 000, 255,
132, 000, 132,
000, 000, 197,
000, 000, 255,
132, 132, 255,
000, 255, 255,
132, 255, 132,
000, 198, 000,
000, 255, 000,
255, 255, 000,
255, 173, 107,
255, 250, 246,
206, 206, 206,
132, 132, 132,
000, 000, 8
};


jake13jake 03-27-2005 01:50 AM

(sorry for the double post, couldn't fit this in one)

That is an array with all of the clothes RGB values. I had to trim leading zeros on the 8.
I don't know why. That array size is only 60... I think, and, also, the other script worked with leading zeros if I cut the array before it's 254th value.... Hmmm...

Zero Hour 03-27-2005 05:48 AM

Wouldn't an array which reaches the max be a very ineffecient method of whatever you're trying to do...?

jake13jake 03-27-2005 02:06 PM

Quote:

Originally Posted by Zero Hour
Wouldn't an array which reaches the max be a very ineffecient method of whatever you're trying to do...?

Probably for the GC Tile Switch scripts, but for my tile editor it would probably be more efficient for cut/copy, otherwise I'd have to do some somewhat complex packing/unpacking info stuff. For the most part I'm posting about this because I know there's a good chance I may encounter it again.

Admins 03-27-2005 07:33 PM

Quote:

Originally Posted by jake13jake
hmmm... do you think it could be because evil put hex code in the array?

Hex numbers should not be a problem, should work fine with Graal script.

Quote:

Originally Posted by jake13jake
I actually trimmed the spaces to see if that would help. I've noticed that leading zeros can sometimes break an array, too.

Stuff like 000 can be a problem, its not accepted as number, must be a single zero

jake13jake 03-28-2005 10:17 PM

Quote:

Originally Posted by Stefan
Hex numbers should not be a problem, should work fine with Graal script.



Stuff like 000 can be a problem, its not accepted as number, must be a single zero

Nice to know. Have any idea why the hex array is breaking the script?


All times are GMT +2. The time now is 04:53 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.