|
Cykops Beginner
Joined: 07 Apr 2003 Posts: 20 Location: Sweden
|
Posted: Fri Nov 21, 2003 2:49 pm
Time counter |
Any easy way to make a time counter?
you do command A and the counter start after a random time(1-20 min) it ends and you want to know how long it was... |
|
|
|
megamog75 Enchanter
Joined: 20 Nov 2002 Posts: 627 Location: USA
|
Posted: Fri Nov 21, 2003 4:24 pm |
you mean the tick timer?
how long inbetween to times
or do you mean
you have a trig that sets %time into a var
and when that trig fires again or anouther trig fires you set the new %time into a new var - one from the other to know how long it was between them? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Nov 21, 2003 6:06 pm |
Use one of the predefined clock variables.
%ctime
%secs
Store your start time in a variable of your own choice, using either an alias or a trigger.
#AL A {#VAR StartClock %ctime;~A}
When you reach whatever event indicates that timing should stop, subtract the start time from the current time.
#TR {All done, how long did it take?} {#MATH ElapsedTime (%ctime - @StartClock);#SAY It took @ElapsedTime seconds}
You would get better results if you told us what you actually want to do, "cast shield" instead of "command A", and gave us details about what results are actually expected, "the shield around you fades away" instead of "after a random time". Without details such as that, our responses can't be particularly meaningful either. But this should be enough for you to figure out your own solution. |
|
|
|
Cykops Beginner
Joined: 07 Apr 2003 Posts: 20 Location: Sweden
|
Posted: Sat Nov 22, 2003 11:53 am |
Got my answer... works like a charm... never thougt of it that way =)
Thanks a mill... |
|
|
|
coras Newbie
Joined: 28 Apr 2004 Posts: 4 Location: USA
|
Posted: Wed Apr 28, 2004 9:07 pm |
I know it's been a while since this was first posted, but I have a few questions on the same general matters:
1. Has anyone figured out a method to use the PC time (%time) with #MATH?
2. Using the %ctime, how would you convert seconds into minutes AND seconds? I am currently using #MATH ElapsedTime ((%ctime - @StartClock)/60), and it gives me minutes, but no seconds (or parts of minutes).
TIA |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Apr 29, 2004 3:50 am |
1. It wouldn't be particularly difficult, but why would anybody bother? Both of the system variables I suggested are already in numeric form. The %time system variable is in a string form which would have to be converted to a number prior to use. Go ahead and do it if you want, but it just adds needless complication.
2. Divide by 60 to get minutes. The remainder is seconds. Use modulo division ( or %mod) to get remainders. You can also get remainders by first dividing and then multiplying by the same number, and subtracting the result from the original number. |
|
|
|
Kalgores Newbie
Joined: 04 Feb 2005 Posts: 3 Location: Melbourne, Australia
|
Posted: Fri Feb 04, 2005 11:59 am |
Lightbulb & Coras... Thank you for your curiousity and knowledge. I've previously (although reading heavily in Zmud help files) not come across the %ctime function/predefined variable. I've used it to great effect in a new script. (a 'stopwatch' timer to go with an Xp tracker on Valheru mud.) I wont post till i test, but it surely beats using the #alarm fuction to make a counter/timer.
Good coding! and Thanks!!!
Kalgores |
|
_________________ Not all those who wander are lost.
-JRR Tolkien |
|
|
|
|
|