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
complex
Apprentice


Joined: 12 Apr 2004
Posts: 134
Location: USA

PostPosted: Wed Jul 14, 2004 12:09 am   

A new database question
 
First I would like to thank vij, and lightbulb for the great help with my id database script!

Ok Im basicly just wanting to know if it is some how possible to to database you mobkills. Meaning a tracker for how many times you kill a mob of a certin name. I think it may be possible but im not sure how to start it. The tag line for the mobs death is as follows


A magical cloud is KILLED!!

I Think that I would need a trigger that basicly adds one evertime a mob is killed. I dont know EVERY mobs name in the game. Im worried that if I want to make a database out of it I would have to basickly make a field for every mob name. Is this possible or just an nice pipe dream?

Thanks... Siegeon

Kotl.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Jul 14, 2004 3:25 am   
 
No database needed, just use a variable.
#TR {(*) is KILLED!!} {#IF %iskey( @kills, "%1") {#ADDK kills {%1} {%eval( %db( @kills, "%1") + 1)}} {#ADDK kills {%1} {1}}}
Reply with quote
complex
Apprentice


Joined: 12 Apr 2004
Posts: 134
Location: USA

PostPosted: Wed Jul 14, 2004 3:33 am   
 
That works awsome. Thanks so much Light
Reply with quote
complex
Apprentice


Joined: 12 Apr 2004
Posts: 134
Location: USA

PostPosted: Wed Jul 14, 2004 3:51 am   
 
Oh one more thing, If I wanted the var information of the mobs and the # of deaths to report to a seperate window (so its always visiable) is that possible?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Jul 14, 2004 6:51 pm   
 
Yes, it's possible. Use the status window.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
complex
Apprentice


Joined: 12 Apr 2004
Posts: 134
Location: USA

PostPosted: Wed Jul 14, 2004 9:27 pm   
 
Ok I have made it into a Status Window, But it looks realy bad.

il14the vengeful ghost of a magical cloud1the vengeful ghost of some enchanted armor1A bear cub4A song bird12the vengeful ghost of a song bird1A bear1the vengeful ghost of Shadowy Wraith2A Child Ghost26the vengeful ghost of Rotting Ghoul3A castle guard1A mountain bandit1A well-armed soldier3A shadow3A dragon cult wizard10A dragon cult priest7the veng

The little boxes are "|" Im still playing with it, but if its something easy to adjust please lend anouther helping hand :)

Thanks
_________________
<Clever text here>
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jul 15, 2004 3:24 am   
 
Use the %expanddb function to get a nicer format.
%expanddb( @kills, %lf, =)

It still probably won't be as nice as you'd like, but anything more will take some extensive behind-the-scenes work to reformat things.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
humblegar
Newbie


Joined: 08 Jul 2003
Posts: 8
Location: Norway

PostPosted: Sat Jul 17, 2004 12:32 pm   
 
I have a similar trigger, based on the one explained here, this is the value:

#IF %iskey( @receiptdb, "%1") {#ADDK receiptdb {%1} {%eval( %db( @receiptdb, "%1") + 1)}} {#ADDK receiptdb {%1} {1}}

The problem is that "iskey" never seems to recognize the keys, so I get 1 of everything, although there are 2 bearskins and 5 boots a.s.o. Can anyone with more experience see what I do wrong?

(#showdb @receiptdb):

a shadowy vest from The Beaten Anvil: 1
a pair of dark gloves from The Beaten Anvil: 1
a bearskin tunic from The Beaten Anvil: 1
a laced pair of brown boots from Jaseem's Fine Clothing: 1
a black pair of silver-tooled boots from Jaseem's Fine Clothing: 1
a black pair of steel-toed boots from The Keep Armory: 1
a pair of shredded wolfskin boots from The Beaten Anvil: 1
_________________
zMud 7.05a
www.wotmud.org
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Jul 17, 2004 3:07 pm   
 
a laced pair of brown boots from Jaseem's Fine Clothing: 1
a black pair of silver-tooled boots from Jaseem's Fine Clothing: 1
a black pair of steel-toed boots from The Keep Armory: 1
a pair of shredded wolfskin boots from The Beaten Anvil: 1

What did you expect? They are all different. zMUD is right.
Black boots aren't brown boots.
Silver-tooled boots aren't steel-toed boots.
Boots from Jaseem's Fine Clothing aren't boots from The Keep Armory.

If you want to count all 'boots' the same, then you have to strip off everything except 'boots'.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
humblegar
Newbie


Joined: 08 Jul 2003
Posts: 8
Location: Norway

PostPosted: Sat Jul 17, 2004 3:24 pm   
 
Let me rephrase, I have for instance 5 pairs of "a black pair of silver-tooled boots from Jaseem's Fine Clothing", sorry for the misunderstanding.

edit:
there are much more items that the trigger runs through than it makes keys, but still the counter is just 1 for those items. I would expect it to either make more keys, or increment the values, but it does not.

Here is most of what I use, notice that the file attempt was my first go, it works fine, but does not "stack" items like I want, so I would have to count each item after the script is done. So now I would like to try the record thing to do a different approach.


#CLASS {chest}
#ALIAS examreceipts {#file (1) %concat( @chest, %time( " d mmmmm yyyy"));#era 1;#file (1) %concat( @chest, %time( " d mmmmm yyyy"));#RESET @receipts;#RESET @receiptcount;exam @chest;#wait;#LOOP @receiptcount {#wait;get <@receiptcount>.receipt @chest;#wait;exam receipt;#wait;put receipt @chest;#wait};#wait;#close 1}
#CLASS 0


#CLASS {chest|receipts}
#TRIGGER {(%d)? a receipt} {#variable receiptcount {%1} {1}}
#TRIGGER {It is a receipt for(*), already redeemable.} {#write (1) {%1};#variable receipts { %additem( %1, @receipts)} {""};#IF %iskey( @receiptdb, "%1") {#ADDK receiptdb {%1} {%eval( %db( @receiptdb, "%1") + 1)}} {#ADDK receiptdb {%1} {1}}}
#CLASS 0
_________________
zMud 7.05a
www.wotmud.org
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Jul 17, 2004 3:52 pm   
 
In that case, no I have no idea what you are doing wrong. There's nothing wrong with the #IF I wrote, or your adaptation of it.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
humblegar
Newbie


Joined: 08 Jul 2003
Posts: 8
Location: Norway

PostPosted: Mon Jul 19, 2004 2:01 am   
 
Alright, its working now, so for anyone remotely interested, this will shuffle through all receipts in a specified container and write the contents to a file, I skipped the shops to make the counting easier for the forums where I use it.

example of file"sack 19 juli 2004.TXT":
[7] a black pair of silver-tooled boots
[1] a black pair of steel-toed boots
[6] a pair of dark gloves
[3] a laced pair of brown boots
[2] a bearskin tunic
[2] a shadowy vest
[1] a pair of shredded wolfskin boots


Here is my newbie code for now, I will probably improve it someday:
Code:

#CLASS {chest}
#ALIAS choosechest {#VAR chest %pick( "p:Choose receipt location", "o:1", "chest", "backpack", "sack", "oilskin", "pouch", "cotton")}
#ALIAS src {#pri {#show @receiptcount}}
#ALIAS examreceipts {#t+ receipts {class};#variable receiptdb %null;#RESET @receiptcount;exam @chest;#wait;#LOOP @receiptcount {#wait;get <@receiptcount>.receipt @chest;#wait;exam receipt;#wait;put receipt @chest;#wait};#wait;#wait;#show u may have to press enter to continue from here;#wait;#file (1) %concat( @chest, %time( " d mmmmm yyyy"));#era 1;#file (1) %concat( @chest, %time( " d mmmmm yyyy"));#loopdb @receiptdb {#write (1) {%concat( "[", %val, "] ", %key)}};#close 1;#t- receipts {class}}
#CLASS 0

#CLASS {chest|receipts}
#TRIGGER {(%d)? a receipt} {#variable receiptcount {%1} {1}}
#TRIGGER {It is a receipt for (*) from *, already redeemable.} {#pri {#IF (%iskey( @receiptdb, %1)) {#ADDK receiptdb {%1} {%eval( %db( @receiptdb, "%1") + 1)}} {#ADDK receiptdb {%1} {1}}}}
#CLASS 0
_________________
zMud 7.05a
www.wotmud.org
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