Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
dalayrcf
Newbie


Joined: 28 Apr 2020
Posts: 1

PostPosted: Tue Apr 28, 2020 7:58 am   

Tracking affects and duration in status window
 
I have added separate cmud classes for each MUD class that I play on a specific MUD. In those classes I have added statuses for affects I want to keep a track of that are shown in a status window. The end result is, the affects and their durations are displayed and the duration left is updated with every tick on the MUD. But what is lacking is an order to the list. The MUD displays affects with decending order of duration, with those about to expire at the bottom. My status window displays them in seemingly random order. Here are the details:

Example:
I check my affects on the mud and I see this
Quote:
You are affected by:
Commune: 'bless' modifies save vs spell by -14 for 59 hours.
Skill: 'detect hidden' for 20 hours.

I have a trigger for "You are affected by:" that does this to clear the database so I can capture the latest affects
Code:
#loopdb @affects {
        #delkey affects %key
      }

Then I have a trigger to capture each of the affects:
Code:
^(Skill|Commune|Physical effect|Spell|Power):\s+\'(.*)\'.*for\s+(\d+)\s+hours\.

Which does:
Code:
#var tmpaff %replace(%2," ","")
#addkey affects @tmpaff %3

I have a status window where all the statuses for the class are shown. Here is the code for the Bless status:
Code:
%if(@affects.bless>=0,%ansi(high,green)Bless-@affects.bless,%ansi(high,red)Bless-Off)

So if bless had worn off (i.e. I was not affected by it) it would show up in the status window as Bless-Off in red but as in the above example it would show up as Bless-59 in green.

Then I have some code that picks up the tick from the MUD and subtracts one hour (or more if I missed some ticks) from each affect duration.

Now, coming to the problem. The statuses show up in random order (or t least looks random to me) and I would like them to show up with the ones with the least time remaining at the bottom. That is also how the affects show up on the MUD when I check them. How can I make that happen.

Just to be clear, right now I see something like this in the status window:
DetectInvis-2
Bless-59
DetectHidden-Off
Invis-32

While I want it to be like this:
Bless-59
Invis-32
DetectInvis-2
DetectHidden-Off

Thanks in advance for any help with this.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Tue Apr 28, 2020 1:08 pm   
 
Take a look over here, I think it has your answer:
http://forums.zuggsoft.com/forums/viewtopic.php?t=19585
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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