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
ixy
Novice


Joined: 18 Mar 2007
Posts: 39

PostPosted: Sun Mar 18, 2007 12:44 pm   

matching one result from database only
 
#ALIAS find {#class dbshow 1;#FORALL %find( %1, "", "name") {#SAY %expanddb( %dbget( %i), %crlf, ": ")};#wait 1000;#class dbshow 0}

Ok so im using a script to match one name and it show the characters name, race and path. the above trigger works fine-ish... (the find alias works from a trigger over a clan talk channel)

Code:

[CLAN] Kaine: 'find rongg'

[SAFE]<3227hp 3499sp 2965st>
[CLAN] Aryne: 'Player: Rongg Race: Ogre Classpath: Valkyrie, Ranger, Shaman, Bard'


How ever if you try to find say "find k" it spams like this

Code:


[CLAN] Kaine: '??Murder Maim Kill?? find k'

[SAFE]<3227hp 3499sp 2975st>
[CLAN] Aryne: 'Player: Kaine Race: Dwarf Classpath: Barbarian, Wizard, Priest, Rogue'

[SAFE]<3227hp 3499sp 2975st>
[CLAN] Aryne: 'Player: Knightotri Race: Gnome Classpath: Paladin, Psionic, Druid, Rogue'

[SAFE]<3227hp 3499sp 2975st>
[CLAN] Aryne: 'Player: Kabaal Race: Minotaur Classpath: Barbarian, Wizard, Shaman, Rogue'

[SAFE]<3227hp 3499sp 2975st>
[CLAN] Aryne: 'Player: Khal Race: Fey Classpath: Barbarian, Psionic, Shaman, Rogue'

[SAFE]<3227hp 3499sp 2975st>
[CLAN] Aryne: 'Player: Kayot Race: Gnome Classpath: Paladin, Wizard, Druid, Rogue'

[SAFE]<3227hp 3499sp 2975st>
[CLAN] Aryne: 'Player: Peak Race: Sidhe Classpath: Valkyrie, Monk, Druid, Bard'

[SAFE]<3227hp 3499sp 2975st>
[CLAN] Aryne: 'Player: Kever Race: Hafling Classpath: Barbarian, Ranger, Priest, Bard'

[SAFE]<3227hp 3499sp 2975st>
[CLAN] Aryne: 'Player: Mikee Race: Sidhe Classpath: Paladin, Wizard, Druid, Bard'

[SAFE]<3227hp 3499sp 2975st>
[CLAN] Aryne: 'Player: Akisma Race: Minotaur Classpath: Barbarian, Wizard, Shaman, Rogue'

[SAFE]<3227hp 3499sp 2975st>
[CLAN] Aryne: 'Player: Shakti Race: Sidhe Classpath: Valkyrie, Monk, Druid, Bard'

[SAFE]<3227hp 3499sp 2975st>
[CLAN] Aryne: 'Player: Kiprin Race: Half-Elf Classpath: Valkyrie, Monk, Druid, Bard'

[SAFE]<3227hp 3499sp 2975st>
[CLAN] Aryne: 'Player: Klaus Race: Gnome Classpath: Paladin, Psionic, Druid, Rogue'

[SAFE]<3227hp 3499sp 2975st>
[CLAN] Aryne: 'Player: Blackx Race: Sidhe Classpath: Paladin, Ranger, Druid, Bard'


Is there any way to make it find exact matchs in the database and no report any that have a recurrence of the requested letter/string in the name?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Mar 18, 2007 5:34 pm   
 
You could put an #IF check around the stuff in the #FORALL. That would allow you to test %i to see if it was an exact match to %1 rather than a partial. Additional checks could be used to rule out invalid name-types (ie, names that are too short or too long) so you don't have to spend time searching for stuff you know isn't going to be in there.

#IF (&%i.name = %1) {do tell stuff} {do nothing, it's just a partial}

The part in bold I'm not sure is right. %find() should be returning database record numbers (ie, 1eq), but the idea is to get to the name part (that would be either & or @, but I forget which and it should be easily found in the helpfile).
_________________
EDIT: I didn't like my old signature
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Tue Mar 20, 2007 8:10 am   
 
There is indeed a simple way. Instead of %find, use %query.

Ie:
#ALIAS find {#class dbshow 1;#FORALL %query( &name = "%1") {#SAY %expanddb( %dbget( %i), %crlf, ": ")};#wait 1000;#class dbshow 0}
Reply with quote
ixy
Novice


Joined: 18 Mar 2007
Posts: 39

PostPosted: Tue Mar 20, 2007 6:04 pm   
 
thanks :)
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