Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
track_xyj
Newbie


Joined: 20 Feb 2002
Posts: 8
Location: USA

PostPosted: Wed Feb 20, 2002 4:14 pm   

string match questions
 
Ok, the wiz in my mud is revising to prevent robot. We have a huge quest list. Typically, when you type a command to check, it will shows like this:
QUEST One: Give Sunny Sword
Then you go buy a sword then send to npc Sunny.

My database used to have 1870 records.

Now the displayed changed to this:
QUEST One: Couldyoupleasegivesunnyasword?
or
QUEST One: SwordpleasegivetoSunny.

Believe me, there is no space in sentence. So I use %numwords to search the key word of npc and item. Is there any simple function to check whether one string is included in another?

As we all know, %numwords("aaabc","aab") = 2, %numwords("aaabc","aaa")=2, but %numwords("aaabc","abc")=1. :(. So I need to combine another %ends in #if, pretty clumsy to run it 1xxx times.

Thanks
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Wed Feb 20, 2002 5:11 pm   
 
That would be the %pos function.

Syntax: %pos(p,s)

return the position of pattern p in string s. Return 0/false if not found
Examples:

#SHOW %pos(ABC,12AB56ABC10ABC)

displays: 7

Troubadour
Reply with quote
track_xyj
Newbie


Joined: 20 Feb 2002
Posts: 8
Location: USA

PostPosted: Wed Feb 20, 2002 5:36 pm   
 
Kick. That is built in function back to 3.xx. Didn't know why it escaped my eyes before.

Thanks a lot. :) Definitely hopes my robot could consume less resources, so I could still reach 60fps in CS.

quote:

That would be the %pos function.

Syntax: %pos(p,s)

return the position of pattern p in string s. Return 0/false if not found
Examples:

#SHOW %pos(ABC,12AB56ABC10ABC)

displays: 7

Troubadour

Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net