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
imri
Beginner


Joined: 15 Apr 2004
Posts: 13
Location: USA

PostPosted: Thu May 20, 2004 1:38 am   

Auto Databaseing from Identify Command
 
I was wondering if anyone could help me make a script for zMUD, that will make my Identify command plug the info into my database for items. The help file, while useful, isn't anywhere close to what my ident info looks like.....I use shattered kingdoms, and they are all about making things...basically not look like numbers, and stuff. They are descriptive, trying to give it a real life sense...I guess. Here is an idea as to what they look like.

This is a small stone triptych, a small stone treasure, weighing 2 lbs.
It is of average quality and is worth approximately 78 silver.
It bears an enchantment to moderately increase resistance to spells.
It bears an enchantment to moderately decrease resistance to charm.


Something like that...the format varies, in that the lines change length, so word wrapping occurs...it always follows this format though.....

This is (item name), a (size) (material) (type of item), weighing (weight) lbs. It is of (quality) quality and is worth approximately (worth) silver. It bears an enchantment to (enchantment amount and type of enchantment).

There can be more than one enchant on any given item. Weapons have a slightly different format, but if you can help me with basic items, I am sure I can alter it to my needs. My database is going to be seperated into Accessories, Armor, and Weapons. Again, only worry about accessories for now...if I have trouble converting, I'll ask for help. These are the fields for my Accessories...

Name, Size, Material, Type, Weight, Quality, Worth, Enchantments..

I hope you can figure it out....I can't get it to work....Thanks a lot.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu May 20, 2004 4:57 am   
 
It appears you've already figured most of it out. I don't know how you want to handle the enchantments so I picked a method: multiple fields with one enchantment per field.

#TR {This is (*), a (%w) (%w) (*), weighing (%d) lbs.} {#VAR item {};#ADDKEY item Enchantments 0;#ADDK item Name {%1};#ADDK item Size {%2};#ADDK item Material {%3};#ADDK item Type {%4};#ADDK item Weight {%5}}
#TR {It is of (%w) quality and is worth approximately (%d) silver.} {#ADDK item Quality {%1};#ADDK item Worth {%2}}
#TR {It bears an enchantment to (*).} {#ADD item.Enchantments 1;#ADDK item Enchantment@item.Enchantments {%1}}

At the end you'll need to query the database for duplicate entries and issue the #NEW command to actually enter the info into the database. If you can't find a suitable pattern, this could be done with an alias, button, or as part of the first trigger before clearing the variable.
#TR {pattern which indicates end-of-ident-info reached} {#IF (%query( @item.Name = &Name)) {} {#NEW All @item}}
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