Graal Forums

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

SaijinGohan 03-06-2002 08:47 AM

String Arrays
 
I am trying to become a better scripter and I have learned variable arrays and I came up with this script as a test:

// NPC made by SaijinGohan
if (created) {
this.test = {random(1,20),random(1,20),
random(1,20),random(1,20),random(1,20),
random(1,20),random(1,20),random(1,20),
random(1,20),random(1,20)};
timeout = 1;
}
if (timeout) {
a = this.test[random(1,9)];
message #v(a);
timeout = 1;
}

Will anyone teach me string arrays or manipulate this test to use string arrays?

;)

Python523 03-06-2002 10:34 AM

I think this is your basic string array:
setarray name,size;
so
if (created){
setarray test,3;
}
if (playerchats&&strequals(#c,test1)){
test[0]=1;
}
if (playerchats&&strequals(#c,test2)){
test[1]=1;
}
if (playerchats&&strequals(#c,test3)){
test[2]=1;
}
That's just a basic thing with arrays
[EDIT]
here's your script converted into string arrays
if (created) {
setarray test,10;
for(i=0;i<=10;i++)
{sleep.05;
test[i]=random(4,20);
timeout = .05;
}}
if (timeout) {
a = test[random(1,9)];
message #v(a);
timeout = .05;
}
[/EDIT]

Python523 03-06-2002 11:00 AM

Quote:

Originally posted by Kaimetsu


No, that's just a normal array. I considered telling this guy the actual definition, but just look at his account name. There's no way I can help a "SaijinGohan"!

O, ok, I just skimmed the newfeatures2001.txt and found what he ment, I didn't know that the addstring, removestring, deletestring, ext were considered arrays, I always considered them normal strings


All times are GMT +2. The time now is 03:38 AM.

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