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


Joined: 17 Feb 2001
Posts: 119
Location: Denmark

PostPosted: Tue Nov 04, 2003 9:10 am   

spell time helper
 
i need some help here...

i want to create some kind of warning system for my spells.
when i cast a spell on a random person or myself or anyone i want to be able to check how long time the spell have until it ends and i want some kind of warning like 5 min. before it ends.

You cast armor on Yah.

armor last 15 min.

so 5 min. before the spells ends i like a line like mayby:
"your armor spell on Yah is ending in 5 min."

or if i type mayby checkspells Yah(<-- this name could be anyone i casted a spell on):
"your armor spell on Yah ends in 7 min."


can anyone help here?
using 6.62
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Nov 04, 2003 10:52 am   
 
The first can be done with a simple alarm.
#TR {You cast armor on (%w)} {#ALA armor%1 +600 {#SAY Your armor spell on %1 is ending in 5 minutes}}

The second would probably require using many variables to track either the start or end time of every spell. One record-variable per person, with spellnames as keys and endtimes as values would probably be best.
#TR {You cast armor on (%w)} {#ADDK Spells%1 {armor} %eval(%ctime + 900)}
#AL checkspells {#IF %defined(Spells%1) {#LOOPDB @Spells%1 {#SAY Your %key spell on Yah ends in %eval((%val - %ctime)/60) minutes}} {#SAY Who?}}

This is only a rough script intended to get you started. It doesn't reset the time and will quite happily inform you that your armor spell on Yah ends in -30 minutes -- that is, half-an-hour ago. I'm sure you can figure out for yourself how best to handle that.
Reply with quote
Morten
Apprentice


Joined: 17 Feb 2001
Posts: 119
Location: Denmark

PostPosted: Tue Nov 04, 2003 12:39 pm   
 
heh thanks alot got me started.

now i just need to figure a way to close/delete them when time is 0
Reply with quote
Morten
Apprentice


Joined: 17 Feb 2001
Posts: 119
Location: Denmark

PostPosted: Wed Nov 05, 2003 11:43 am   
 
on the mud i play we got a system that fire a line off every 3 sec. it shows hp/sp/ep/hunger.
the line looks like this:

RDMP #### hp/hpmax sp/spmax ep/epmax hunger

im think (puuh it takes alot of power to do that) is it posible to check the database varible and time left to see if it is =< 0 and if it is delete that spell from the varible?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Nov 05, 2003 4:13 pm   
 
Yes, that's possible, but you'd have to keep track of all the variables created by the script. It's probably easier to do it when you check a variable.
#AL checkspells {#IF %defined(Spells%1) {#LOOPDB @Spells%1 {#IF (%ctime > %val) {#SAY Your %key spell on %1 ends in %eval((%val - %ctime)/60) minutes} {#DELK Spells%1 {%key}}} {#SAY Who?}}
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