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
rafa80
Newbie


Joined: 30 Nov 2002
Posts: 8

PostPosted: Sun Dec 01, 2002 4:45 am   

help with %find in a trigger
 
I have a bot logging chars online, then adding them to a database along with lvl class etc. One of my triggers is when someone wants to see certain data on a person, if they type in say find doc it will come up with the first person with doc in the name, so if there is a person named doc further down the list then someone named doctor, it shows the stats for doctor. Here is the trigger I'm using:

charnums=%db( %find( "%{2}", all), num)
#IF {@charnums} {
emote >> ~{CYAN~}Name ~{cyan~}%db( @charnums, Name), ect ect (redundant part shortaned for post)
say End of List. 1 out of %numrec( all) chars listed.
} {
say Sorry, couldn't find %{2}
say End of List. 0 out of %numrec( all) chars listed.
}
Is there a way to either loop through and show All the records that have the search string in them, or some way to make it only return the rec num for an entry that matches it exactly (except for upper/lower case) The later of the two would be better because I also have script that updates the stats on the char, and given the above example with doc and doctor, it would put the stats for doc into doctor, and doc would never get updated. (how to do both would be the best help of all:-P) Thx for any help.

By the way I have 6.16 that I finally broke down and bought a reg for(best thing I've bought in a while) and am now a zmud addict (before I was sticking to 4.62 and didn't get too into it cuz there wasn't too much you could do)
Reply with quote
rafa80
Newbie


Joined: 30 Nov 2002
Posts: 8

PostPosted: Mon Dec 02, 2002 3:17 am   
 
I seem to have fixed part of the problem. I made a new view named Names which is sorted by name. then I do %find (@tempname, names) and it searches the sorted view. in the above example, it fixes the problem. There is still another problem it does not fix. Say what you want is doc and there is a char named adoc. it will return adoc instead of doc because it is before the doc in the view. is there some function that tells it to search for EXACTLY that string? (if not I think this would be a good feature to add to the suggestions forum) maybe something simular to %ismember (except for a db) and have it return the record number or false if it doesn't find it...
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Dec 02, 2002 3:23 am   
 
%query with a suitable expression.

LightBulb
Senior Member
Reply with quote
rafa80
Newbie


Joined: 30 Nov 2002
Posts: 8

PostPosted: Mon Dec 02, 2002 4:25 am   
 
Works like a charm, thx Lightbulb!
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