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
doomfyre
Apprentice


Joined: 03 Jan 2002
Posts: 152
Location: USA

PostPosted: Sun Jun 16, 2002 10:59 pm   

Monitoring equipment damage in a window
 
The mud is Realms of Dispair, using v6.26
What i want to do is have a status window which will keep track of the condition of equipment as it gets damaged in battle. Here are sample mud outputs:

darkness gets damaged
a strand of polished jade gets damaged
a dark, ever shifting belt gets damaged
Demonic Whispers gets damaged

To determine the extent of the damage, you use examine, such as exam darkness, exam jade, exam belt. Doing that returns the following:

As you look more closely, you notice that it is in superb condition. or,
As you look more closely, you notice that it is in dire need of repair. or,
As you look more closely, you notice that it is very badly worn.

among others. All damage levels have the "As you look more closely, you notice that it is" part in common.

What i've done sofar is made a trigger for each piece of eq i have getting damaged, which then sets that piece to the eq variable, and examines it.

#TR {^a dark, ever shifting belt gets damaged} {#var eq belt; exam belt}

and a trigger for the exam...

#TR {^As you look more closely, you notice that it is (*)} {#var condition "%1"}

So what im looking for in the status window, is to pick up the first instance of something getting damaged, with its condition next to it. Then, if something else gets damaged, list that below with its condition, etc. If the same piece gets damaged again, i want it to update the condition of that piece. There's a problem of course, with my way of doing it. Consider the following as what could happen.

Malevolence gets damaged. (captures Malevolence to @eq, exams Malevolence)

exam Malevolence

As you look more closely, you notice that it is showing a bit of wear. {captures showing a bit of wear to @condition)

So now i have Malevolence showing a bit of wear in the status window.

then, say something else gets damaged, how do i keep the status of Malevolence, and add the newly damaged piece with its condition, without it changing the condition of Malevolence? And if Malevolence takes another hit, how do i update its condition, and leave the others alone?

I've made a variable for each piece of eq which is basically just its short name, if that could be used somehow. Thanks for any suggestions
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Jun 17, 2002 11:46 am   
 
I suggest using a record variable where the keys are the names of the eq and the values are the conditions. You can the unse the #ADDKEY command to add/modify a piece of eq and the %expanddb function to format it for displaying in the status window. What you need is to change the trigger that matches the condition from:
#TRIGGER {^As you look more closely, you notice that it is (*)} {#VAR condition "%1"}

to:
#TRIGGER {^As you look more closely, you notice that it is (*)} {#ADDKEY eqstatus @eq {%1};#STW {%expanddb(@eqstatus, %crlf, ": ")}}

So all this does is to use the #ADDKEY command as soon as you see the condition fo the item. The #ADDKEY command will add the item to the record variable if it doesn't exist already, or modify its values if it does. Then it uses the #STW command to present everything in the status window by calling the %expanddb function which allows us to temporarily change how the record variable is stored so that it may contain some newlines and colons.

Kjata
Reply with quote
doomfyre
Apprentice


Joined: 03 Jan 2002
Posts: 152
Location: USA

PostPosted: Mon Jun 17, 2002 7:32 pm   
 
Thanks very much for the reply, i'll give that a shot.
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