setarray .@test[0],1;
The [0] stats the index where the array should be start to be written. An Index can holds up to 128 information, but the last Index is 127 since an array always starts with the index 0.
To gain the arraysize, there is the command *getarraysize() also you need to know where the index starts.
Example: I have an array which starts with the index 1:
setarray .@boxid[1],512,513,514;
Now I wanna know the array size:
mes getarraysize(.@boxid); // To display it, I'm gonna use "mes"
The next would be, if I wanna choose one of the information I have to create an menu.
set .@boxm$,"";
for (set .@m,0; .@m < getarraysize(.@boxid); set .@m,.@m + 1)
set .@boxm$,.@boxm$ + "- "+.@boxid[.@m]+ ( (.@boxid==0)?"":":");
Then we'll have to open the menu.
set .@s,select(.@boxm$);
Since *select creates an "@" variables called "@menu" which contains the position I chose
from the menu. I also saved it into a extra variable in case I would need the an other menu later, so I don't lose the number.
If the array would start with an [0] I would have to do add a "- 1" after "(.@boxm$)", so it would like this:
set .@s,select(.@boxm$) - 1;
Now to confirm it, what I choose:
mes "You have chosen: "+.@boxid[.@s];
mes "Is that correct?";
if(select("- Yes:- No") == 2) close;
Like you saw I used another select, so the @menu has changed it's content.
Then the npc ask us what to do next.
mes "What do you want to now?";
if(select("- Edit:- Noting) == 2) close;
Now he wants to know the new value for the array.
mes "Please type the new value it should have:";
input @new;
After I have give him the new value, now he needs to insert it into the array:
setarray .@boxid[.@s],@new;
So that ends my example.
I hope I could be of help, since I'm not good at teaching others D:
Regards,
Chris