Graal Forums

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

GoZelda 09-21-2003 10:39 PM

Arrays
 
Can someone give me some info on arrays? I tried to declare one like this:

this.array = {1,2,3,4,5,6,7,8,9};

but it didn't seem to work.
Also, how would you make multi-dimensional arrays in graal? And what about setarray? Thanks in forward (or whatever)

protagonist 09-21-2003 10:43 PM

Setarray makes string arrays. It's ideal for text or a mixture of text and numbers.

SaijinGohan 09-21-2003 10:45 PM

Well your array looks fine to me. You can read those numbers with
this.array[0] through this.array[8].

Ex:

say2 #v(this.array[2]); would return 3!

DustyPorViva 09-21-2003 10:48 PM

Quote:

Originally posted by protagonist
Setarray makes string arrays. It's ideal for text or a mixture of text and numbers.
setarray makes variable arrays, not string.

Oh and setarray:

NPC Code:
setarray this.test,5;


would then create the variable:
NPC Code:
this.test={0,0,0,0,0};


And then you could manually access each value by:
NPC Code:
this.test[2]=8;


would make the third value eight.

protagonist 09-21-2003 10:50 PM

Quote:

Originally posted by DustyPorViva


setarray makes variable arrays, not string.

Ewps. Read it wrong.

Python523 09-21-2003 10:55 PM

multi dim arrays will be supported in the new engine

SaijinGohan 09-22-2003 01:25 AM

Quote:

Originally posted by DustyPorViva

NPC Code:
setarray this.test,5;


would then create the variable:
NPC Code:
this.test={0,0,0,0,0};


And then you could manually access each value by:
NPC Code:
this.test[2]=8;


would make the third value eight.

But you cant

this.test[2]=8;

until you

setarray this.test,5;

DustyPorViva 09-22-2003 01:34 AM

You can manually make an array by this.test={x,x,x,};

thats why I said: then

GoZelda 09-22-2003 06:16 PM

Okay people, thanks, i now understand :)


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

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