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
Belmyrddyn
Magician


Joined: 17 Oct 2001
Posts: 371
Location: USA

PostPosted: Tue Dec 18, 2001 4:28 am   

Scripting the Database
 
Okay, I have a unique problem (don't we all, though?). I'm creating a combat script, and in my MUD you can type:
Assess combat

A faenrae reaver (1: nimbly balanced) who is flanking you at melee.
A wind hound (3: nimbly balanced) who is facing you at melee.
A rock troll (1: extremely unbalanced) who is behind you at missle range.

What I need is a way to pick up two values (the name of the critter attacking me), and that number inside the parenthesis. I then need to be able to group these two values together (only way I know of is the database), and parse that text for the combat script.

The difficulty I'm facing is that I need to update this text everytime I get the line;
The (whatever) begins to advance on you!

However, to prevent multiple records of each mob being recorded, I have to clear the database of all the previous records before I can accept the new data. How precisely should I delete all the records in a database?

Database Name: Critters
Fields:
1) Name
2) Number

Also, if anyone has ANY suggestions on how to deal with this WITHOUT resorting to the database, PLEASE offer them. I'm new to zMUD programming, so PLEASE help!

Belmyrddyn
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Tue Dec 18, 2001 5:02 am   
 
Rather than place this information in the actual database, use a database variable (aka record variable).


#TRIGGER {(*) ~((%d): *~) who is {flanking|facing|behind} you at {melee|missile range}.} {
#ADDKEY critters "%1" %2
}
#TRIGGER {The * begins to advance on you!} {
#VAR critters %null
assess combat
}


The keys in the @critters record variable will be the names; the corresponding values will be the number present.

Troubadour
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