NPC Code:
if(created){
setstring this.string,Welcome,to,graal,forums;
setstring this.search,forums;
}
if(playerenters){
pos = lindexof(#s(this.search),this.string);
if(pos>=0) message Word found at position: #v(pos);
else message Word not found;
}
I will explain it anyway:
NPC Code:
if(created){
setstring this.string,Welcome,to,graal,forums; // string list of course
setstring this.search,forums; // the word you're searching
}
That string (this.string) is divided into 4 pieces, you count the pieces since the number 0. (same method of triggeraction and other commands), so:
Welcome - piece
0
to - piece
1
graal - piece
2
forums - piece
3
NPC Code:
if(playerenters){
pos = lindexof(#s(this.search),this.string);
if(pos>=0) message Word found at position: #v(lindexof(#s(this.search),this.string));
else message Word not found;
}
I presume you know how lindexof work, so, create a variable (you don't really need it, but i like to) to hold the value of the lindexof(), just check if it is >= 0 and voalá, here is your example script.
Hope this help, took me - 5 minutes of sleep, good night. n_n'