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
john_taylor_jr
Wanderer


Joined: 17 Jan 2003
Posts: 57
Location: USA

PostPosted: Sat Mar 29, 2003 2:16 am   

Database Help
 
I have a who command that looks like:
Beaker the Lunatic Chemist of Madness and Mayhem, Praetorian of the Society
of Scryers.

Beaker is what I want to add to the Name column of my database I call Players

When it says
the Lunatic Chemist of Madness and Mayhem
I want the db to check Alchemist as my single option guild column

When it says
Praetorian of the Society
of Scryers.
I want it to select Society of Inovation
in the single option org column and gnome in the single option race column

Technology is my friend.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Mar 29, 2003 2:39 am   
 
Should be fairly simple:
#TR {(%w) the Lunatic Chemist of Madness and Mayhem, Praetorian of the Society
of Scryers.} {#VAR Wholist {};#ADDKEY Wholist Name %1;#ADDK Wholist guild alchemist;#ADDK Wholist org {Society of Inovation};#ADDK Wholist race gnome;#IF %find( %1, , Name) {} {#NEW All @Wholist}}

LightBulb
Advanced Member
Reply with quote
john_taylor_jr
Wanderer


Joined: 17 Jan 2003
Posts: 57
Location: USA

PostPosted: Sat Mar 29, 2003 3:57 am   
 
That would work fine for a gnomish alchemis innovator but I'd like something more generic so I can add multiple people with different information

Technology is my friend.
Reply with quote
john_taylor_jr
Wanderer


Joined: 17 Jan 2003
Posts: 57
Location: USA

PostPosted: Sat Mar 29, 2003 3:59 am   
 
Also note that of scryers is on a new line and indented
And will the who list be able to hold multiple entries? Or just one person?

Technology is my friend.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Mar 29, 2003 5:02 am   
 
I can't give you anything more generic since you haven't provided the information to do so. However, you (since you have the information) could probably do so for yourself. I mean, I might have guessed that "the Lunatic Chemist of Madness and Mayhem" was an alchemist, but I probably wouldn't have guessed that "Praetorian" was a goblin and I'd certainly never have guessed that "Society of Scryers" meant Society of Inovators. I can't begin to imagine what your other guilds, races, and organizations are or what titles would correspond to each.

You'll most likely want to use list and/or record variables in constructing a "generic" trigger. You'll probably need either matched lists, or one list and one record variable for each section of the title.

#TR {(%w) the ({@guildtitles}), ({@racetitles}) of the ({@orgtitles}).} {#VAR Wholist {};#ADDKEY Wholist Name %1;#ADDK Wholist guildtitle {%2};#ADDK Wholist orgtitle {%4};#ADDK Wholist racetitle {%3};#IF %find( %1, , Name) {} {#NEW All @Wholist}}

An indented wordwrap is probably being done by zMUD. If not, you'll probably have to put a LOT more work into devising a trigger.

The record variable, @Wholist, is intended for one person at a time. It just provides an easy way to accumulate the information for a single database entry. You don't have to use that variable name. Pick something else if it confuses you.

LightBulb
Advanced Member
Reply with quote
john_taylor_jr
Wanderer


Joined: 17 Jan 2003
Posts: 57
Location: USA

PostPosted: Sat Mar 29, 2003 8:36 pm   
 
Ok I wrote 4 triggers that don't trigger on top of eachother. Here is one of them

Pattern:^(%w) th? ([~-a-z' ]).
Command:
#IF ((%2) =~ "Angelic Knight of Redemption") {
#VAR Wholist {}
match=1
#ADDKEY Wholist Name %1
#ADDK Wholist Guild paladin
#ADDK Wholist level 370
}
#IF ((%2) =~ "Ordained Noble of the High Heavens") {
#VAR Wholist {}
match=1
#ADDKEY Wholist Name %1
#ADDK Wholist Guild paladin
#ADDK Wholist level 380
}
#IF ((%2) =~ "Virtuous Paladin of Severan") {
#VAR Wholist {}
match=1
#ADDKEY Wholist Name %1
#ADDK Wholist Guild paladin
#ADDK Wholist level 390
#ADDK wholist race human
}
#IF ((%2) =~ "Archangel of Divine Retribution") {
#VAR Wholist {}
match=1
#ADDKEY Wholist Name %1
#ADDK Wholist Guild paladin
#ADDK Wholist level 400
}
#IF ((%2) =~ "Water Boy") {
#VAR Wholist {}
match=1
#ADDKEY Wholist Name %1
#ADDK Wholist Guild alchemist
#ADDK Wholist level 0
}
#IF ((%2) =~ "Puddle Jumper") {
#VAR Wholist {}
match=1
#ADDKEY Wholist Name %1
#ADDK Wholist Guild alchemist
#ADDK Wholist level 1
}
#IF ((%2) =~ "Seeker of the Mystic River") {
#VAR Wholist {}
match=1
#ADDKEY Wholist Name %1
#ADDK Wholist Guild alchemist
#ADDK Wholist level 10
}
#IF ((%2) =~ "Neophyte of Alchemy") {
#VAR Wholist {}
match=1
#ADDKEY Wholist Name %1
#ADDK Wholist Guild alchemist
#ADDK Wholist level 20
}
#IF ((%2) =~ "Student of Alchemy") {
#VAR Wholist {}
match=1
#ADDKEY Wholist Name %1
#ADDK Wholist Guild alchemist
#ADDK Wholist level 30
}
#IF %find( %1, , Name) {} {add=1}
#IF ((@add = 1) & (@match=1)) {#NEW All @Wholist}
match=0
And it goes on for pages like this.
Which when I do a large who call.
For example whoing all the players
It lags zmud a lot and I'm not even finished entering in all of the titles yet.
I was wondering if their was a more efficient way to do this.

Technology is my friend.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Mar 29, 2003 10:06 pm   
 
The fastest, most efficient method would probably be individual triggers for each title. That's essentially what you're doing now anyway, with all those "pages" of #IF checks.

The first questions you should probably ask yourself are, "Do I really need this? Will it be worth the effort of writing a script and the lag it will cause whenever I do a 'who'?" After all, you could just learn to read those titles and decipher them for yourself.

As I said before, I'd probably use matched lists, or a matched list and record variable. It's not as efficient as individual triggers, but it's much easier to make updates to.

#VAR GuildTitles {Angelic Knight of Redemption|Ordained Noble of the High Heavens|Virtuous Paladin of Severan|Archangel of Divine Retribution|Puddle Jumper|Seeker of the Mystic River|Neophyte of Alchemy|Student of Alchemy}
#ADDK GuildLevels {Angelic Knight of Redemption=Paladin 370|Ordained Noble of the High Heavens=Paladin 380|Virtuous Paladin of Severan=Paladin 390|Archangel of Divine Retribution=Paladin 400|Puddle Jumper=Alchemist 1|Seeker of the Mystic River=Alchemist 10|Neophyte of Alchemy=Alchemist 20|Student of Alchemy=Alchemist 30}
#TR {(%w) th? ({@GuildTitles}),} {#VAR Wholist {};#ADDK Wholist Name %1; #ADDK Wholist guild %word( %db( @GuildLevels, %2), 1);#ADDK Wholist level %word( %db( @GuildLevels, %2), 2);#IF (!%find( %1, , Name)) {#NEW All @Wholist}}

LightBulb
Advanced Member
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