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


Joined: 02 Sep 2004
Posts: 42

PostPosted: Thu Sep 02, 2004 5:21 pm   

database help please
 
I took this from the finished scripts section (it's not complete or functioning)

What i'd like to do is to create an actual equipment database and when i recite an identify scroll the information contained will automatically be updated in the database.

If someone can help me fix this or has a better way of doing this i'd appriciate it.


#TRIGGER {Object &Item.Name} {}
#TRIGGER {Type: &Item.Type}{}
#TRIGGER {Item is: &Item.Class} {}
#TRIGGER {Worn by: &Item.Race} {}
#TRIGGER {Weight: &Item.Weight} {}
#TRIGGER {Value: &Item.Value} {}
#TRIGGER {AC Apply is &Item.ACApply } {}
#TRIGGER {Resistance to damage is &Item.Resistance} {}
#TRIGGER {HITROLL By &Item.Hit} {}
#TRIGGER {DAMROLL By &Item.Damage} {}
#TRIGGER {HIT -N- DAM By &Item.Damage &Item.Hit} {}
#TRIGGER {MOVE By &Item.Move} {}
#TRIGGER {HIT_POINTS By &Item.HP} {}
#TRIGGER {WIS By &Item.WIS} {}
#TRIGGER {INT By &Item.INT} {}
#TRIGGER {DEX By &Item.DEX} {}
#TRIGGER {STR By &Item.STR} {}
#TRIGGER {CON By &Item.CON} {}
#TRIGGER {MANA By &Item.MANA} {}
#TRIGGER {DAMAGED By &Item.DAMAGED} {}
#TRIGGER {ARMOR By &Item.ARMOR} {}
#TRIGGER {$} {#T- identify;#IF (!%null(@NewItem)) {#NEW @ItemType @Item}} identify
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Thu Sep 02, 2004 8:08 pm   
 
You provide very little information. In general you first need to create the database where the records are to be stored. The zMUD script just enters data in this existing database.

Edit: http://www.silverbridge.org/~varmel/zmud/tutorials/zmuddb.htm
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Tue Sep 07, 2004 6:05 pm   
 
Okay i can't seem to get this to work at all so i'm in need of some very specific help :)

when i recite a identify scroll below is what the mud outputs.

You recite a scroll of identify which dissolves.
You feel informed:
Object 'ring brass seaofdreams', Item type: ARMOR
Item is: ANY_CLASS NoBits
Worn by: Medium races Large races Charmies
Weight: 1, Value: 10000
AC-apply is 1 Resistance to damage is 0
Can affect you as:
Affects : HIT_POINTS By 25
Affects : DAMAGED By 1


from this, I want entered into a database automatically all the information shown.

I can't seem to get the vars to even show up nor can i seem to get even one field to enter into the database. Do i have to specify what database this goes into in the script? This seems so difficult for me but i know there are some guru's who would find this super simple.

DCB
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Tue Sep 07, 2004 6:30 pm   
 
dcb wrote:
Okay i can't seem to get this to work at all so i'm in need of some very specific help :)

I assume you have created the database already and have it loaded.


Quote:

when i recite a identify scroll below is what the mud outputs.

You recite a scroll of identify which dissolves.
You feel informed:
Object 'ring brass seaofdreams', Item type: ARMOR
Item is: ANY_CLASS NoBits
Worn by: Medium races Large races Charmies
Weight: 1, Value: 10000
AC-apply is 1 Resistance to damage is 0
Can affect you as:
Affects : HIT_POINTS By 25
Affects : DAMAGED By 1


from this, I want entered into a database automatically all the information shown.

I can't seem to get the vars to even show up nor can i seem to get even one field to enter into the database. Do i have to specify what database this goes into in the script? This seems so difficult for me but i know there are some guru's who would find this super simple.
DCB

The explanation on that webpage should work pretty well here as well. Instead of having one trigger doing the entire identification we have to break it down to a few triggers.

Code:
#TRIGGER {Object '&{item.name}', Item type: &item.type} {}
#TRIGGER {Item is: &item.class} {}
#TRIGGER {Weight: &{item.weight}, Value: &{item.value}} {}
#TRIGGER {AC-apply is &{item.ac} Resistance to damage is &{item.damageRes}} {}
#TRIGGER {Affects : HIT_POINTS By &item.hp} {}
#TRIGGER {Affects : DAMAGED By &item.damaged} {}


I am not sure how to properly parse the WornBy line.

Edit: This might work with the WornBy line:
Code:
#TRIGGER {Worn by: (*)} {
  temp = ""
  #forall @wornby {#if (%match( %1, %i)) {temp=%concat( @temp, %i, ",")}}
  temp = %delete( @temp, %len( @temp), 1)
  item.wornby = @temp
  }
#VAR wornby {medium races|large races|charmies}


Edit 2: So the full trigger set becomes:

Quote:
#CLASS {identify}
#VAR wornby {medium races|large races|charmies}
#TRIGGER {Object '&{item.name}', Item type: &item.type} {}
#TRIGGER {Item is: &item.class} {}
#TRIGGER {Weight: &{item.weight}, Value: &{item.value}} {}
#TRIGGER {AC-apply is &{item.ac} Resistance to damage is &{item.damageRes}} {}
#TRIGGER {Affects : HIT_POINTS By &item.hp} {}
#TRIGGER {Affects : DAMAGED By &item.damaged} {}
#TRIGGER {Worn by: (*)} {
  temp = ""
  #forall @wornby {#if (%match( %1, %i)) {temp=%concat( @temp, %i, ",")}}
    temp = %delete( @temp, %len( @temp), 1)
    item.wornby = @temp
    }
#TRIGGER {$} {
  #if (%find( @item.name) = "") {#new "" @item}
  #t- identify
  }
#CLASS 0

#ALIAS identify {#t+ identify;cast identify %1}


I hope this helps. If you don't get it to work, please ask again :).
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Tue Sep 07, 2004 7:14 pm   
 
Okay well at least the vars are showing up now however, nothing is being written to the database yet. and i'm not sure about the worn by yet either i'll look at that after i start getting things to write to the database.

Maybe a little help with the database itself?

I created a database called dceq for this project. I used the standard eq template. What am i missing?
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Tue Sep 07, 2004 7:46 pm   
 
dcb wrote:
Okay well at least the vars are showing up now however, nothing is being written to the database yet. and i'm not sure about the worn by yet either i'll look at that after i start getting things to write to the database.

Maybe a little help with the database itself?

I created a database called dceq for this project. I used the standard eq template. What am i missing?

First try to add data manually to the database from the zMUD prompt:
#new "" {Name=test}

Do you get a new entry added to the database after issuing that command? Note that the database window has to be open, and the database has to be loaded.
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Tue Sep 07, 2004 7:55 pm   
 
Well if the database is open (pinned to the top window) and loaded and i enter this command yes it creates an entry in the database.
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Tue Sep 07, 2004 8:43 pm   
 
Okay i think i have things actually writing to the database now!!

NOW, i seem to be having another problem haha.

After i've recited a identify scroll and the information is in "memory" values in the variables do not clear. Therefore when i identify a second piece of eq the values from the first item are also inserted in the database for the second item along with any additional information.
Wow thats confusing.

So how do i clear the values and get ready for the next entry?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Tue Sep 07, 2004 10:21 pm   
 
Short and sweet blank out the item variable before the first line containing useful data. Since you have something to trigger off I will use a trigger. If you didn't then an alias would have been the appropiate method.

#TRIGGER {^You recite a scroll of identify which dissolves.$} {item=""}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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