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


Joined: 31 Aug 2001
Posts: 48
Location: USA

PostPosted: Sun Apr 14, 2002 8:24 am   

Mob Database Help
 
hi,
I am trying to capture 2 items from the mud and put into a database. Now along with this im trying to keep from adding duplicate items to the database. I have messed with and prob messed it up and now can't even get it to report to the database *snicker let along do a sort.

Here is the code im using..
Pattern:
^------------ (*) is Level (%d)
commands:
#t+ mobdb
dbmobname=%1
dbmoblevel=%2

Pattern:
$
commands:
#if (%find(@dbmobname) = "") {#var mobdb_temp_value -1} {#forall %find(@dbmobname) {#var mobdb_temp_rec %dbget(%i)
#if (%number(@mobdb_temp_rec.Value) = %number(@mobdb_value)) {#var mobdb_temp_value @mobdb_value}}}
#if (@mobdb_temp_value != @mobdb_value) {#var mobdb_newrec ""
#addkey mob_newrec Keywords ~"@dbmobname~"
#addkey mob_newrec Level @dbmoblevel
#new "Mobdb" @mobdb_newrec
#t- mobdb} {#echo Item already in database.
#t- mobdb}
in class mobdb

Something is wrong and i know it has to be simple i just can't seem to figure out why it isn't working correctly. Sorry prob something super simple, but im pulling out my hair ;)

Reavor
Reply with quote
reavor
Novice


Joined: 31 Aug 2001
Posts: 48
Location: USA

PostPosted: Sun Apr 14, 2002 8:31 am   
 
hi,
Sorry to bother you... i got it all figured out, i guess i shoulda put it on paper cause after i read my note i was like... oh duh!..

Thanks anyway,

Reavor
Reply with quote
reavor
Novice


Joined: 31 Aug 2001
Posts: 48
Location: USA

PostPosted: Tue Apr 16, 2002 3:09 pm   
 
hi,
Well i came accross another problem and this database stuff is new to me so im having lots of problems, here is the deal.

I want to kill a mob and log several things into a database about the mob i killed. Name, Level, Area, and mob vuln.
I have the name, and level so far, the rest ill somehow add later. Here is my problem. Lets say i kill a guard in one area and lets say it is level 20. The database logs the guard at level 20. Then i kill another guard in another area, same name but say it is level 18. It says mob already in database. What i need is a check to see if mobname exists and then check to see if it exists with the same level. or check the levels to make sure that if 2 mobs have the same name but different levels it will log both of them. Here is the code i have to capture hte name and level, and check the name to make sure not already in database. Any help would be greatly appreciated.

pattern:
$
command:
#if (%find(@dbmobname) = "") {#var mobdb_temp_value -1} {#forall %find(@dbmobname) {#var mobdb_temp_rec %dbget(%i)
#if (%number(@mobdb_temp_rec.Value) = %number(@mobdb_value)) {#var mobdb_temp_value @mobdb_value}}}
#if (@mobdb_temp_value != @mobdb_value) {#var mobdb_newrec ""
#addkey mobdb_newrec Mobname ~"@dbmobname~"
#addkey mobdb_newrec Level @dbmoblevel
#new "Mobdb" @mobdb_newrec
#echo Mob Added.
#t- mobdb} {#echo Mob already in Database.
#t- mobdb}

Reavor
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