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
Varazet
Newbie


Joined: 05 Aug 2004
Posts: 5

PostPosted: Fri Aug 06, 2004 2:01 pm   

Database and Makables
 
Alright, here is a home run if you can riddle me this...I am making a script that pulls information from a make list and sorts it into the database. This will be all good and well except for the way the make list is organized on the MUD. Here is an shortened example:

(It is best to look at this example by right clicking the post, view source and scroll down. The post messes up the spacing.)

Keyword to bring up: make list

Keyword Type lvl Skill required
bracer armor_wrist 5 armor craft
helmet armor_head 10 armor craft
armored gloves armor_hands 30 armor craft
armored boots armor_feet 30 armor craft
ring ring 15 jewelry craft
necklace necklace 15 jewelry craft
bracelet bracelet 16 jewelry craft
sword sword 25 weapon craft
mace mace 25 weapon craft
flail flail 25 weapon craft


Problems:

1) I need it to register through each line, ie bracer line, then helmet line, then armored gloves etc.

2) It needs to sort the word(s) into the correct field. "Bracer" and "armored gloves" would
be placed into keyword, "armor_wrist" and "armor_head" into type, etc. This shouldn't be
a difficult thing to do except I have nothing to set the command against, as it is
seperated by just space and not Keyword:bracer for instance. I've considered replacing the
space, but I still have problem 1.

This information will later be queried from the database for pick lists that make it much
easier to enter information for making items, as well as keeping information up to date and
tailoring to a specific character's ability to make different things. A friend and I have
mulled over this, and I felt it was time to ask the professionals before some form of
brain trauma began to develop. If you need more specifics than what I have provided.
Please, let me know. Thank you in advance for any assistance.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Aug 06, 2004 6:12 pm   Re: Database and Makables
 
Code:

Keyword                        Type           lvl  Skill required
bracer                         armor_wrist     5   armor craft
helmet                         armor_head      10  armor craft
armored gloves                 armor_hands     30  armor craft
armored boots                  armor_feet      30  armor craft
ring                           ring            15  jewelry craft
necklace                       necklace        15  jewelry craft
bracelet                       bracelet        16  jewelry craft
sword                          sword           25  weapon craft
mace                           mace            25  weapon craft
flail                          flail           25  weapon craft


You should probably use the fixed-width wildcard, &nn. You'll need some way to tell when you've reached the end of the list (I assumed a blank line). You'll need to decide what to do when a Keyword already exists in the database.
Code:
#TR makelist1 {Keyword                        Type           lvl  Skill required} {#TEMP {$} {#STATE makelist1 0}}
#COND {(&30) (&14) (&3) (*)} {#VAR makelist {};#ADDK makelist Keyword {%trim( %1)};#ADDK makelist Type {%trim( %2)};#ADDK makelist lvl {%number( %3)};#ADDK makelist Skill {%trim( %4)};#IF (%query( &Keyword = @makelist.Keyword)) {} {#NEW All @makelist}} {LoopLines|Param=99}

I didn't test the query.
_________________
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
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