 |
sumuma Newbie
Joined: 10 Aug 2007 Posts: 3
|
Posted: Fri Aug 10, 2007 12:57 am
Help with multiple timers!!! |
I'm not even sure if its possible, but would like to know at least..
What I would like to have:
When I cast different spells, i would like a countdown timer for each spell for when
the spell will fade.
Also, as an option, having all the timers counting down in a separate small window
with all the names of the spells and the timer counting down next to it, but this is not
needed if its too hard.
Is this possible?
I'm not very good at all with making script. So, if this is possible, any help is appreciated.
Thank you.
[edit] I think i'm starting to figure it out with #alarm command |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Fri Aug 10, 2007 1:40 am |
All of that is possible. The main thing is to use an alarm with *1 as the time factor. We can't really tell you how to do everything you want without more information, but I can tell you the basic idea.
The alarm triggers every second and adjusts a counter. Your status window displays the difference between the counters with %eval. The original counters used in this comparison are set based on the %secs Predefined Variable when they are cast. Beyond that there is not much I can say without more information. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
sumuma Newbie
Joined: 10 Aug 2007 Posts: 3
|
Posted: Fri Aug 10, 2007 3:02 am |
mm.. thanks vijilante.. here's what i've tried so far:
Pattern: The world slows down around you! (spell started output from game)
Value: #ts 1000 (random number to see how long spell lasts)
Pattern: Time speeds up suddenly! (spell faded output from game)
Value: #ti (stops timer for me to calculate how long spell lasted)
the times i calculated for that spell varied about 91-130
i'm not sure why the spell doesnt give the same number each time..i guess there is a difference in the game time and zmud time
could you give me an example of a type of alarm i should make?
#ALARM The world slows down around you! {*100} {#ECHO timer started} |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Aug 10, 2007 3:11 am |
Alarms are purely time-based. You could think of them like triggers (and that's how they're handled in the GUI) but instead of their pattern matching text, it matches time. You don't need the star if you're just matching "do this every 100 seconds". If you meant "do this once in 100 seconds and then don't do it again", you need to add a plus to the start of your alarm "pattern". Alarms run their commands when the time expires, not when it starts. Try this:
#trig {The world slows down around you!} {#alarm +100 {#echo 100 seconds has now passed}}
Vijilante's suggestion would be to have some kind of record of all your active spells and their time left, and then use a one-second alarm to reduce the time left on each by 1 each time, like:
#alarm 1 {#loopdb Spells {#addkey %key %val-1}}
or something. Try reading the helpfile for #alarm.
But of course this isn't going to work if the spell doesn't always last the same amount of time and there's no way of making the MUD tell you exact timings. You might need to try a different method, or just stick to having a rough idea when it'll fade. |
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Fri Aug 10, 2007 11:42 am |
If you can find the maximum and the minimum lengths you could probably use a percent warning.
Muds that have a random time for spell duration usually don't actually use any random number between 0 and max.
Most muds take a percentage of the max and will always give you at least that. Then they use the remainder of the percent to find their random number to add to this base.
If your mud does this you could find a maximum and a minimum spell duration. Then place in a counter that warns you after the minimum spell duration has passed.
Let's pretend that 91 is the minimum and 130 is the max.
So if 91 is %70 of 130, which it is, and it IS the minimum then it is possible that all spells of that skill level could fail after a minimum of 91 seconds or %70 of their max if their max is longer. Then you could have a counter that counts down from %100, 130 in this case, and turns red when it reaches %30 or in this case 39. This way you will know that you are living on borrowed time for this spell and it could fail at any time. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
 |
sumuma Newbie
Joined: 10 Aug 2007 Posts: 3
|
Posted: Fri Aug 10, 2007 7:07 pm |
thank you vijilante, fang, and arminas, your suggestions are very helpful.
i think i will try to set up the trigger to check against 'time elapsed since last boot' time in the game.
i never thought about arminas's random time for spell duration, which very well may be the case also.
i'll try to post what i finally use as my alarm/triggers |
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Fri Aug 10, 2007 9:52 pm |
Quote: |
the times i calculated for that spell varied about 91-130
i'm not sure why the spell doesnt give the same number each time..i guess there is a difference in the game time and zmud time |
It all depends on how your mud is coded, if spells are set to turn off on a specified *tick* instead of an exact time this could throw the time off. there are other reasons that could affect this as well though! |
|
|
 |
|
|