Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   quick question (https://forums.graalonline.com/forums/showthread.php?t=428)

vergil 03-22-2001 05:45 AM

If I assign an array 5 values then I do a blah=thisarray will blah still have all the values that thisarray did?

Example:
NPC Code:

myarray=1;
myarray[0]=1;
myarray[1]=5;
myarray[2]=67;

mything=myarray;



Will mything have all of the [] values also?

kyle0654 03-22-2001 06:47 AM

NPC Code:

myarray=1;
myarray[0]=1;
myarray[1]=5;
myarray[2]=67;

mything=myarray;



mything would equal 1 after this code. It reads myarray and a variable, but will read myarray[#] as a position in the array myarray. If you want to copy an array to another array, do this:

NPC Code:

myarray = {1, 5, 67};
setarray myarray2, arraylen(myarray);
for (this.z = 0; this.z < arraylen(myarray); this.z++) {
myarray2[this.z] = myarray[this.z];
}



That should work. I haven't actually used setarray in a while though...I'm used to doing it the quick way like I did in the first line of that.

vergil 03-22-2001 12:12 PM

thanks a bunch :)


All times are GMT +2. The time now is 01:57 PM.

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