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
Dravon
Beginner


Joined: 05 Jan 2002
Posts: 29
Location: USA

PostPosted: Tue Jul 01, 2003 8:23 pm   

What am I doing wrong
 
Hi there I got this script but it wont work I was wondering if anyone could spot what my problem is.


#ALIAS CountHits { #VAR NumHits 0
#VAR NumMisses 0
#VAR NumSwings 0
#VAR StartSecs %secs
#VAR StartTime %time( "hh:nn:ss")
#ECHO Hit Counter started at @StartTime
#T+ HitCounter }




#CLASS {HitCounter} {disable}
#ALIAS stopcount { #T- HitCounter
#T- CountIt
#var Elapsed %eval( (%secs-@StartSecs)/1000)
#var HitsPerMinute %eval( @NumHits/(@Elapsed/60))
#var HitPercent %eval( (@NumHits*100)/@numSwings)
#ECHO Counter stopped at %time( hh:nn:ss): Hits: @NumHits Misses: @NumMisses: Total: @NumSwings Started: @StartTime
#ECHO HitsPerMinute = @HitsPerMinute
#ECHO Hit Rate: @HitPercent% }
#ALIAS stats { #var Elapsed %eval( (%secs-@StartSecs)/1000)
#var HitsPerMinute %eval( @NumHits/(@Elapsed/60))
#var HitPercent %eval( (@NumHits*100)/@numSwings)
#ECHO Count at %time( hh:nn:ss): Hits: @NumHits Misses: @NumMisses: Total: @NumSwings Started: @StartTime
#ECHO HitsPerMinute = @HitsPerMinute
#ECHO Hit Rate: @HitPercent% }
#TRIGGER {^You {swing your|claw at}} {#T+ CountIt}
#TRIGGER {^You attempt a} {
#ADD NumMisses 1
#ADD NumSwings 1 }
#TRIGGER {^You deliver a} {
#ADD NumHits 1
#ADD NumSwings 1 }
#CLASS 0

#CLASS {HitCounter|CountIt} {disable}
#TRIGGER {the {attack|swing|shot} {barely|nearly|misses|goes|fumbles} *} { #ADD NumMisses 1
#ADD NumSwings 1
#T- CountIt }
#TRIGGER {the {attack|swing|shot} is a *} { #ADD NumHits 1
#ADD NumSwings 1
#T- CountIt }
#CLASS 0


this is what I get but it doesnt seem to be recognizeing my hits or attempts

Hit Counter started at 14:03:57
Count at 14:03:57: Hits: 0 Misses: 0: Total: 0 Started: 14:03:57
HitsPerMinute =
Hit Rate: %

thanks a bunch for the help
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jul 01, 2003 11:29 pm   
 
1. You probably didn't have any hits between 14:03:57 and 14:03:57 for it to count. That's 0 seconds after all.

2. You might not be enabling the CountIt class since you don't provide a full path in your #T+ command.
#T+ {HitCounter|CountIt}
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Jul 01, 2003 11:45 pm   
 
You should check with an #IF on @numSwings and @Elapsed to assure you don't divide by zero as well.
Reply with quote
Dravon
Beginner


Joined: 05 Jan 2002
Posts: 29
Location: USA

PostPosted: Wed Jul 02, 2003 12:08 am   
 
ah thanks
it was number 2
2. You might not be enabling the CountIt class since you don't provide a full path in your #T+ command.
#T+ {HitCounter|CountIt}

I did #CLASS {HitCounter|CountIt} {enable}
instead of this
#CLASS {HitCounter|CountIt} {disable}
and it counts now thanks a bunch. I need to get you all to move here for a week to fix all this stuff[:p]
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