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


Joined: 27 Jun 2001
Posts: 82

PostPosted: Tue Dec 04, 2001 6:16 am   

Autokill logger?
 
Okay, I'm getting pretty good at scripting, but never tried any DB stuff. I was wondering if it would be possible to create a database that would record whatever I killed and how many I have killed to date? Something like:

A castle Soldier: 1
A mean Dwarf: 1
A Valley Elf: 1

and etc. It would need to introduce a new name if that mob was not named there. The text i get when i kill a mob is:

You have killed A valley Elf!
You receive 20,000 Exp!
Reply with quote
cingulli
Wanderer


Joined: 30 Aug 2001
Posts: 53
Location: Finland

PostPosted: Tue Dec 04, 2001 11:24 am   
 
how about logging everything and just using 'grep' or something similar ,)
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Tue Dec 04, 2001 2:51 pm   
 
If you have a variable called @KillList, then the trigger is as follows:

#TRIGGER {^You have killed (*)} {#IF (%ismember("%1", @KillList)) {#LOOPDB @KillList {#IF ("%key" = "%1") {%val = %eval(%val + 1)}}} {#ADDKEY @KillList "%1" 1}}

To see what's in it, you can do something like:
#LOOPDB @KillList {#SAY %key: %val}

Acaila
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Tue Dec 04, 2001 8:09 pm   
 
A faster method would be:


#TR {You have killed (*)!} {
#IF %iskey(@KillList, "%1") {
#ADDKEY KillList "%1" %eval(%db(@KillList, "%1")+1)
} {
#ADDKEY KillList "%1" 1
}
}


Troubadour
Reply with quote
undergod
Wanderer


Joined: 27 Jun 2001
Posts: 82

PostPosted: Thu Dec 06, 2001 7:15 am   
 
Okay, and how do I view all this newfound information? =) The trigger captures all the information...
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Thu Dec 06, 2001 7:39 am   
 
For both Troubadour's trigger and my own that would be:

#LOOPDB @KillList {#SAY %key: %val}

Acaila
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Thu Dec 06, 2001 10:06 am   
 
A nifty speed menu item to check your kills of one particular mob is:


#MENU {Kill Count} {
#IF %null(%selected) {
#SAY Please highlight the full name of the mob.
} {
#IF %iskey(@KillList, %selected) {
#SAY You have %db(@KillList, %selected) kills of %selected~.
} {
#SAY You have no kills of %selected~.
}
}
}


Highlight the name of the mob anywhere in the MUD output, then right-click. Select "Kill Count" in the pop-up menu.

Troubadour
Reply with quote
undergod
Wanderer


Joined: 27 Jun 2001
Posts: 82

PostPosted: Sat Dec 08, 2001 2:49 am   
 
Okay, I have no idea how to do this... *sigh* sometimes my MUD sends a > character. Here's a quick example of what I mean.

> smile
You smile
>

So, after it responds to the command, it sends a > character. In theory to line up your commands. But, if you type a command just before the mob dies, you get:

> punch mob
You punch a mob!
> mob dies

In this case, the above mentioned kill logger will register "> mob" as a kill. Is there anyway to get rid of this?
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Sat Dec 08, 2001 6:44 am   
 
quote:

> punch mob
You punch a mob!
> mob dies

In this case, the above mentioned kill logger will register "> mob" as a kill. Is there anyway to get rid of this?



Use the %replace function to strip out the offending characters:

#ADDKEY KillList %replace("%1", "> ", "") %eval(%db(@KillList, %replace("%1", "> ", ""))+1)

#ADDKEY KillList %replace("%1", "> ", "") 1

Troubadour
Reply with quote
undergod
Wanderer


Joined: 27 Jun 2001
Posts: 82

PostPosted: Sat Dec 08, 2001 7:13 am   
 
quote:

Use the %replace function to strip out the offending characters:

#ADDKEY KillList %replace("%1", "> ", "") %eval(%db(@KillList, %replace("%1", "> ", ""))+1)

#ADDKEY KillList %replace("%1", "> ", "") 1

Troubadour



So it would look like this in it's complete form?

#TR {You have killed (*)!} {#IF %iskey(@KillList, "%1")
{#ADDKEY KillList %replace("%1", "> ", "") %eval(%db(@KillList, %replace("%1", "> ", ""))+1)}
{#ADDKEY KillList %replace("%1", "> ", "") 1}}
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Sat Dec 08, 2001 8:46 am   
 
Yep.

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