 |
BlackSmith Apprentice

Joined: 08 Dec 2002 Posts: 152
|
Posted: Thu Feb 03, 2005 1:10 am
"Timer" question |
This much i have got
When this txt comes from mud:
"[22"53'44] You feel a shield around you"
..three variables are updatet containing the time the shield got up and one indication it is up.
But when the folowing txt comes from mud:
"[23"02'32] You feel the shield vanish"
a line like this would be send to mud:
"party report Shield vaished (HH:MM:SS)"
the HH:MM:SS would the calculated time from the start of the shield to the end of the shield.
ok, i can do it with math funtions and with one helpper varable (#math Shield_lasted_seconds (Shield_seconds-Current_seconds) ) but here comes the real Q.
How can i make it show in status bar also so that it shows time how long the spell has been on?
Thus that i get this work:
status bar: Prots: %if(Shield=true,Shield ~(~TheTimesShieldHasBeenOn),)
I have tried to look existing scripts doing soemthing like this but i cant hack 'em. The debugging makes my head hurt. |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Feb 03, 2005 3:23 am |
Depends on how fancy you want to get. If you just want to see the end result and aren't worried about watching a timer, just add @Shield_lasted_seconds into a status line setting (if you want, you can create a new status line just for this variable):
#status {Prots: %if(Shield=true,Shield ~(@shield_lasted_seconds~),"")}
If you want to make it a timer you can watch as it counts up or down, add an alarm (this may require a conversion routine from h:m:s to seconds) that increments/decrements @shield_lasted_seconds:
#alarm "tShieldSpellAlarm" *1 {#add @shield_lasted_seconds 1}
and enable or disable this alarm (using #T+ tShieldSpellAlarm or #T- tShieldSpellAlarm) in the triggers for the appropriate lines. |
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
BlackSmith Apprentice

Joined: 08 Dec 2002 Posts: 152
|
Posted: Thu Feb 03, 2005 8:02 am |
MattLofton wrote: |
If you want to make it a timer you can watch as it counts up or down, add an alarm (this may require a conversion routine from h:m:s to seconds) |
not realy. why not just make a separate alarm counters for minutes and hours?
only real problem that i see here is that this does not use the time i get from mud, thus if zMud crashes the alarmers get whacked thus they give wrong numbers when geting it on again.
you dont think a way to use the times i get from mud and work around them, but still get a "running" (dunno a better translation) timer for status bar?
dont take me wrong, the alarm idea is great but like you asked, i want it fancy and idiot-proof if possible. |
|
|
 |
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Thu Feb 03, 2005 11:18 am |
I have something similar for a balance regain timer on the mud I play
Code: |
#CLASS {utils|stopWatch} {enable}
#ALIAS StopWatch {#VARIABLE stopWatch {%time( s.z)};#IF (@startWatch > @stopWatch) {#MATH stopWatch (@stopWatch + 60)};#MATH stopWatch (@stopWatch - @startWatch);#IF (@startWatch = 0) {} {#SHOW %left( @stopWatch, 4) seconds};#VARIABLE startWatch {0};#VARIABLE stopWatch {0}}
#ALIAS StartWatch {#VARIABLE StartWatch {0};#VARIABLE StartWatch {%time( s.z)}}
#VAR StartWatch {0} {0}
#VAR StopWatch {0} {0}
#CLASS 0 |
So you type 'StartWatch' wait a while, then 'StopWatch' and it tells you how long inbetween
Could quite easily modify the variable names to have 'StartShield' and 'StopShield' and then display the result where you want it.
Hope it helps
(Note: This stopwatch counts only under 1 minute, since balance regain times on my mud are never over 60 seconds. Still, the basics are there to be modified if needed) |
|
|
 |
BlackSmith Apprentice

Joined: 08 Dec 2002 Posts: 152
|
Posted: Thu Feb 03, 2005 5:43 pm |
i tried with the alarm thing. Got this:
Code: |
#TRIGGER "Mind Development On" {^You feel your mind developing.$} {#VA (MindDevelopment) {1} {0} {Protections};#COLOR bold;#WA 100;#VA (MindDevelopment_Hours) {0} {@MindDevelopment_Hours} {Protections};#VA (MindDevelopment_Minutes) {0} {@MindDevelopment_Minutes} {Protections};#VA (MindDevelopment_Seconds) {0} {@MindDevelopment_Seconds} {Protections};#ALARM "MindDevelopment_Hours_Counter" *3600 {#add @MindDevelopment_Hours 1};#ALARM "MindDevelopment_Minutes_Counter" *60 {#IF (60<=@MindDevelopment_Minutes) {#add @MindDevelopment_Hours -60} {#add @MindDevelopment_Minutes 1}};#ALARM "MindDevelopment_Seconds_Counter" *1 {#IF (60<=@MindDevelopment_Seconds) {#add @MindDevelopment_Seconds -60} {#add @MindDevelopment_Seconds 1}}} "Protections" {prompt|case}
#TRIGGER "Mind Development Off" {^Your brain suddenly seems smaller.$} {#VA (MindDevelopment) {0} {0} {Protections};#T- "MindDevelopment_Hours_Counter";#T- "MindDevelopment_Minutes_Counter";#T- "MindDevelopment_Seconds_Counter";party report Mind Development ends ~(%if( 0<@MindDevelopment_Hours, @MindDevelopment_Hours~h, "") %if( 0<@MindDevelopment_Minutes, @MindDevelopment_Minutes~m, "") %if( 0<@MindDevelopment_Seconds, @MindDevelopment_Seconds~s, "")~)} "Protections" {prompt|case}
|
this only results for 3 new triggers that have trigger partners "*1", "*60" and "*3600", but it they dont work (they dont increase the time).
What i have typoed or is there something missing? |
|
|
 |
BlackSmith Apprentice

Joined: 08 Dec 2002 Posts: 152
|
Posted: Fri Feb 04, 2005 7:58 pm |
nevermind. found the problem.
all @ should be removed from #ADD things
BlackSmith wrote: |
#ALARM "MindDevelopment_Hours_Counter" *3600 {#add @MindDevelopment_Hours 1};#ALARM "MindDevelopment_Minutes_Counter" *60 {#IF (60<=@MindDevelopment_Minutes) {#add @MindDevelopment_Hours -60} {#add @MindDevelopment_Minutes 1}};#ALARM "MindDevelopment_Seconds_Counter" *1 {#IF (60<=@MindDevelopment_Seconds) {#add @MindDevelopment_Seconds -60} {#add @MindDevelopment_Seconds 1}}} "Protections" {prompt|case} |
|
|
|
 |
BlackSmith Apprentice

Joined: 08 Dec 2002 Posts: 152
|
Posted: Sun Feb 06, 2005 8:16 am |
im too stupid for this alarm thing.
cant get it work.
i made them with %time() function. |
|
|
 |
BlackSmith Apprentice

Joined: 08 Dec 2002 Posts: 152
|
Posted: Tue Feb 08, 2005 11:03 am |
here is how i after all made it.
Hopely someone in future gets some use of it.
Code: |
#CLASS {Protections|FlexShield}
#VAR FlexShield_Caster {} {}
#VAR FlexShield {0} {0}
#VAR FlexShield_Minutes {0} {0}
#VAR FlexShield_Seconds {0} {0}
#VAR FlexShield_Last_Caster {} {}
#TRIGGER "FlexShield last caster storer" {^(%w) (*) '^ !)'$} {#VA (FlexShield_Last_Caster) {%1} {} {FlexShield};#SUB {%1 %2 '^ !)' (Force Shield)}} "" {prompt|case}
#TRIGGER "FlexShield On" {^You sense a flex shield covering your body like a second skin.$} {#VA (FlexShield) {1} {0} {FlexShield};#VA (FlexShield_Minutes) {0} {} {FlexShield};#VA (FlexShield_Seconds) {0} {} {FlexShield};#CO bold;#IF (@FlexShield_Last_Caster="You") {#VA (FlexShield_Caster) {me} {} {FlexShield}} {#VA (FlexShield_Caster) {@FlexShield_Last_Caster} {} {FlexShield}};#T+ "FlexShield Alarm"} "" {case}
#TRIGGER "FlexShield Off" {Your flex shield wobbles, PINGs and vanishes.} {#VA (FlexShield) {0} {0} {FlexShield};#CO bold;#IF (@FlexShield_Caster="me") {#SUB {Your flex shield wobbles, PINGs and vanishes. ~(%if( 0<@FlexShield_Minutes, @FlexShield_Minutes m , "") %if( 0<@FlexShield_Seconds, @FlexShield_Seconds s, "")~)}} {party say emote flex shield wobbles, PINGs and vanishes. ~(@FlexShield_Caster's FlexShield lasted: %if( 0<@FlexShield_Minutes, @FlexShield_Minutes m , "") %if( 0<@FlexShield_Seconds, @FlexShield_Seconds~s, "")~)};#T- "FlexShield Alarm"} "" {case}
#ALARM "FlexShield Alarm" {*1} {#ADD FlexShield_Seconds 1;#IF (59<@FlexShield_Seconds) {#ADD FlexShield_Minutes 1;#ADD FlexShield_Seconds -@FlexShield_Seconds}} "" {disable}
#CLASS 0
|
|
|
|
 |
|
|