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


Joined: 07 Dec 2001
Posts: 11
Location: USA

PostPosted: Sat Dec 08, 2001 4:25 am   

challenge for the trigger guys to play with
 
heres something i wanted for a while now and have messed with making but no luck .. havent even gotten close...

i want to make a exp counter... to keep track of the exp i am getting... heres what i get when i kill a mobile...

You receive 203,229 of 203,229 experience points.

ok what i want it to do is be able to turn it on by typing exp counter on or something of the sort... will start it... or even #t+ counter would work... i want it to keep track of the exp i am getting and how many kills i have made since turning it on. untill i say exp counter off or something of the sort... then it will somehow report how much exp i have gotten that run how much time that run took and the average exp per minute. what i had in mind would look like this...

you say. exp counter on.(counter starts counting)
killing killing killing killing killing.... ect..
you say exp counter off. (counter stops counting and reports by say)
say you killed 20 mobs worth a total of 22222 exp in 10 minutes. thats 2000 exp per minute.
counter resets...

i think this will be complicated.. mabie not even possible but if it is you guys can do it... im getting nowhere with it... thanks


Bd
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Sat Dec 08, 2001 6:04 am   
 
Try this:


#ALIAS xpON {
#T+ Xp_Counter
#VAR xpGain 0
#VAR mobsKilled 0
#VAR startTime %secs //%secs is number of milliseconds since midnight
}
#TRIGGER Xp_Counter {You receive (%x) of %x experience points.} {
#ADD xpGain %replace("%1", ",", "") //strips commas out of number
#ADD mobsKilled 1
}
#ALIAS xpOFF {
#T- Xp_Counter
#MATH duration ((%secs - @startTime)/60000)
#IF (@duration < 0) {#ADD duration 1440} //If your play period runs over midnight, adjusts for reset of %secs
#SAY You killed @mobsKilled mobs worth a total of @xpGain exp in @duration minutes. That's %eval(@xpGain/@duration) exp per minute.
}


Troubadour
Reply with quote
blackdragon
Beginner


Joined: 07 Dec 2001
Posts: 11
Location: USA

PostPosted: Sat Dec 08, 2001 6:11 am   
 
shout i put the //red comments in or are those explanations.? just clarifieng.. thanks again ill try it out

Bd
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Sat Dec 08, 2001 6:22 am   
 
Leave them out, they're just explanations. zMUD will recognize them as comments because of the // which precedes them. Note: %secs is in milliseconds, so I had to change the conversion constant in the second alias.

Troubadour
Reply with quote
blackdragon
Beginner


Joined: 07 Dec 2001
Posts: 11
Location: USA

PostPosted: Sat Dec 08, 2001 6:41 am   
 
say ok inital run is done of it and this is what i get... when i type xpoff...

You killed 5 mobs worth a total of 027,90529,30224,53432,83428,315 exp in 0 minutes. That's exp per minute.

what i actually got was
27,905 29,302 24,534 32,834 23,315 which actually took about 10 seconds.... i can configure my mud to not read ,'s in numbers im gonna try that see if it matters or try a longer run and see what happens... but thats what i got was 5 mobs .... and ill look back and make sure i didnt leave anything out.
thanks

Bd
Reply with quote
blackdragon
Beginner


Joined: 07 Dec 2001
Posts: 11
Location: USA

PostPosted: Sat Dec 08, 2001 6:45 am   
 
ok turning comas off seems to have fixed the numbers problem from what i can tell initally... but it still shows a
thats (blank) exp per minute. is this possibly because my runs havent lasted more than a minute in the test phase?
ill check that next you might have gotten it right first try.. =0)


Bd
Reply with quote
blackdragon
Beginner


Joined: 07 Dec 2001
Posts: 11
Location: USA

PostPosted: Sat Dec 08, 2001 7:02 am   
 
ok nevermind ummm works good for long runs this is what i got on the last run i had...
You killed 30 mobs worth a total of 5247854 exp in 8 minutes. That's 655981 exp per minute.
so it works great...
thanks you da man T
grin


Bd
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Dec 10, 2001 7:09 pm   
 
quote:
thats (blank) exp per minute. is this possibly because my runs havent lasted more than a minute in the test phase?



Yep, zMUD doesn't like to divide by zero. To avoid this, modify the xpOFF variable to divide by 1 for short runs.


#ALIAS xpOFF {
  #T- Xp_Counter
  #MATH duration ((%secs - @startTime)/60000)
  #IF (@duration < 0) {#ADD duration 1440}
  #IF (@duration = 0) {#VAR duration 1} //to avoid division by zero
  #SAY You killed @mobsKilled mobs worth a total of @xpGain exp in @duration minutes. That's %eval(@xpGain/@duration) exp per minute.
  }

LightBulb
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