View Single Post
  #2  
Old 09-08-2001, 04:40 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
The following script might work, since I'm writing it here and now without testing:
NPC Code:
if (created) {
setstring string,abbaaaabaab;
setstring partstring,b;
this.partcount=0;
this.indexof=0;
while (this.indexof!=-1) {
this.indexof=indexof(#s(partstring),#e(this.indexo f,-1,#s(string));
this.partcount+=(this.indexof!=-1);
}
message #s(partstring) occurs #v(this.partscount) times in #s(string);
}


If it does work it should display the following message: "b occurs 4 times in abbaaaabaab"
__________________

Reply With Quote