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


Joined: 01 Mar 2008
Posts: 64

PostPosted: Wed May 14, 2008 10:53 pm   

database help
 
I'm looking to get a database of items.. the proper name, and a keyword for that item. I would also need to be able to call up that keyword up based on the item given.. i.e. helmet with a four-foot spike, keyword helmet or spike (either). I'm not very good with database entry or reading.. any help would be appreciated!
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Tue May 20, 2008 11:18 am   
 
I wrote a small article about item databases that might help: http://www.silverbridge.org/~varmel/zmud/tutorials/zmuddb.htm
Reply with quote
Ralph1971
Wanderer


Joined: 01 Mar 2008
Posts: 64

PostPosted: Wed May 21, 2008 12:07 am   
 
I took that and ran a bit.. but ran into a lil problem.. if the item was not in the database, it added it nicely, but if it was already in the database, it still wanted to add it..
this is the scripting I used:
#CLASS {mbot}
#TRIGGER {@midchar tells you 'midas &{item.keyword}'} {#new "" @item;say @item.name added to database with keyword @item.keyword}
#TRIGGER {^&midchar gives you &{item.name}{.}} {#if %find( @item.name="") {say @item.name exists in the database with the keyword @item.keyword;#var item ""} {tell @midchar Please tell me keyword - {keyword} for @item.name, where the keyword is the word you used to give this item to me.}}
#CLASS 0

on the second trigger, I switched the IF result commands back and forth, still got the same results...
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Wed May 21, 2008 8:29 am   
 
Ralph1971 wrote:

on the second trigger, I switched the IF result commands back and forth, still got the same results...

You need to add a check to the line that adds the item:
#TRIGGER {@midchar tells you 'midas &{item.keyword}'} {
#if ( %find( @item.name)="") {
#new "" @item
say @item.name added to database with keyword @item.keyword
}
}

So if no item is found in the database, it is added. This also hints an error in the second trigger where you have switched role of the two blocks. Notice:
#if %find( @item.name="") {
// Item is not in the database as it was not found
} {
// Item is in the database.
}

I hope that helps
Reply with quote
Ralph1971
Wanderer


Joined: 01 Mar 2008
Posts: 64

PostPosted: Thu May 22, 2008 3:35 am   
 
It's adding just fine, the issue is when I am given an item that is already in teh database. It gets the item.name correct, but the item.keyword is whatever it was last, or if I put in the #var item "" at the end, it is blank.
says <item name> already in database with keyword <item.keyword>. the keyword is not the correct keyword from tht entry
_________________
Win7-home - Cmud 3.33a
WinXP-pro - Zmud 7.21
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Thu May 22, 2008 6:07 am   
 
Ralph1971 wrote:
It's adding just fine, the issue is when I am given an item that is already in teh database. It gets the item.name correct, but the item.keyword is whatever it was last, or if I put in the #var item "" at the end, it is blank.
says <item name> already in database with keyword <item.keyword>. the keyword is not the correct keyword from tht entry

You can retrieve the entry from the database:
entryID = %find(@item.name)
entry = %dbget(@entryID)
Reply with quote
Ralph1971
Wanderer


Joined: 01 Mar 2008
Posts: 64

PostPosted: Sat May 24, 2008 3:42 pm   
 
So ok.. that works great.. I have the window open and can watch as the items are added.. but when I close the zmud window, or the database window, the data isn't saved.
The first night the items were put in, worked great.. but ever since then, it doesn't save.
_________________
Win7-home - Cmud 3.33a
WinXP-pro - Zmud 7.21
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