|
Gylen Newbie
Joined: 20 Nov 2003 Posts: 3
|
Posted: Thu Nov 20, 2003 4:35 pm
Duration timer for buffs (output formating) |
I have a many trigers setup as below, basicly one for each buff type.
#CLASS {prot-Unstun}
#TRIGGER {chanting appears to do absolutely nothing.} {
#var unstuntime %ctime
party say Unstun Active.
#if !%ismember( Us, @prots) {#var prots %additem( Us, @prots)}
}
#TRIGGER {^It doesn't hurt} {
party say Unstun Expired. Lasted %eval( (%ctime-@unstuntime)) seconds.
#var unstuntime {0} {0}
#var prots %delitem( Us, @prots)
}
#CLASS 0
It works great, except I would like to format the output in HH:MM:SS.
Anyone know how to accomplish this?
Current output:
Unstun Expired. Lasted 200 seconds.
Wanted output:
Unstun Expired. Lasted [0h:12m:3s]. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Nov 20, 2003 6:44 pm |
Just do the math.
Hours is seconds divided by 3600. ((%ctime - @unstuntime) / 3600)
Minutes is (remaining) seconds divided by 60. The remainder after accounting for hours can be found using modulus division. (((%ctime - @unstuntime) 3600) / 60)
Seconds is the remainder after accounting for minutes. This can also be determined with modulus division. ((%ctime - @unstuntime) 60) |
|
|
|
Gylen Newbie
Joined: 20 Nov 2003 Posts: 3
|
Posted: Thu Nov 20, 2003 9:27 pm |
#CLASS {prot-Unstun}
#TRIGGER {chanting appears to do absolutely nothing.} {
#var unstuntime %ctime
party say Unstun Active.
#if !%ismember( Us, @prots) {#var prots %additem( Us, @prots)}
}
#TRIGGER {{^It doesn't hurt} {
party say Unstun Expires. Lasted %eval((%ctime - @unstuntime) / 3600)h:%eval(((%ctime - @unstuntime) 3600) / 60)m:%eval ((%ctime - @unstuntime) 60)s
#var unstuntime {0} {0}
#var prots %delitem( Us, @prots)
}
#CLASS 0
It gives me a syntax error at the first modulus divison:
h:%eval(((%ctime - @unstuntime) 3600) / 60)
~~~~~~~~~~~~~~~~~~~~~^ syntax error |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Thu Nov 20, 2003 11:34 pm |
You can ignore this particular syntax error, it has appeared in every version since 6.16. Just never been fixed totally. If want it to go away you can use the %mod function instead of the mod () operator.
|
|
|
|
Gylen Newbie
Joined: 20 Nov 2003 Posts: 3
|
Posted: Fri Nov 21, 2003 2:21 am |
Thank you for the help.
In case anyone else is looking for a simular trig:
#CLASS {prot-Unstun}
#TRIGGER {chanting appears to do absolutely nothing.} {
#var unstuntime %ctime
party say Unstun Active.
#if !%ismember( Us, @prots) {#var prots %additem( Us, @prots)}
}
#TRIGGER {^It doesn't hurt} {
party say Unstun Expires. %eval( (%ctime - @unstuntime)/3600)h:%mod( ((%ctime - @unstuntime))/60, 60)m:%mod( (%ctime - @unstuntime), 60)s
#var unstuntime {0} {0}
#var prots %delitem( Us, @prots)
}
#CLASS 0
Output is : Unstun Expires. 0h:8m:58s |
|
|
|
|
|