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


Joined: 31 Oct 2006
Posts: 22

PostPosted: Fri Dec 01, 2006 1:57 am   

xp/minute
 
im looking to make a script to keep track of my exp per minute, that i can start and reset at will.

You receive 10243 experience points.

I don't really know where to start, the script or just some variables to start with would be nice, i'd rather not use a timer.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Dec 01, 2006 4:17 am   
 
Datarecord Variable named XPPerMinute (set this up via the Settings Editor, it's easier than doing it via script code)
--with key named XPGained (set to -1)
--with key named StartTime (set to -1)
--with key named EndTime

#alias xpm {#if (%null(%1)) {#noop no option provided, show current data;#if (@XPPerMinute.starttime != -1) {#if (@XPPerMinute.endtime != -1) {#SAY @XPPerMinute.XPGained exp gained in %eval((@XPPerMinute.EndTime - @XPPerMinute.StartTime) / 60) minutes = %eval(@XPPerMinute.XPGained /((@XPPerMinute.EndTime - @XPPerMinute.StartTime) / 60)) exp~/minute} {{#SAY @XPPerMinute.XPGained exp gained in %eval((%secs / 1000) - @XPPerMinute.StartTime) / 60) minutes = %eval(@XPPerMinute.XPGained /((@XPPerMinute.EndTime - @XPPerMinute.StartTime) / 60)) exp~/minute}}} {#noop option provided, determine what to do;#if (%ismember(%1,"start|end|reset")) {#noop is valid option;#case %ismember(%1,"start|reset|end") {#noop start;XPPerMinute.starttime = %eval(%secs / 1000);XPPerMinute.endtime = -1;XPPerMinute.XPGained = 0} {#noop end;XPPerMinute.EndTime = %eval(%secs / 1000);#SAY @XPPerMinute.XPGained exp gained in %eval((@XPPerMinute.EndTime - @XPPerMinute.StartTime) / 60) minutes = %eval(@XPPerMinute.XPGained /((@XPPerMinute.EndTime - @XPPerMinute.StartTime) / 60)) exp~/minute;XPPerMinute.StartTime = -1;XPPerMinute.EndTime = -1;XPPerMinute.XPGained = 0}} {#noop is not valid option, show syntax;#say USAGE: xpm ~[start|reset|end~]}}}

#trigger {You receive (%d) experience points.} {#if (@XPPerMinute.StartTime != -1) {#add XPPerMinute.XPGained %1;#sub {You receive %1 experience points. ~(%eval(@XPPerMinute.XPGained /((@XPPerMinute.EndTime - @XPPerMinute.StartTime) / 60)) exp~/minute~)}}}

It's untested and from the top of my head, but I think I covered all the particulars for you. Basically...

1)XPM by itself will check whether you are tracking XP per minute, and if so will give you the latest numbers (numbers not available after the END display)

2)XPM START and XPM RESET will reset everything back to beginning values

3)XPM END will stop monitoring and display the numbers

The trigger simply determines if it needs to keep track of experience.
_________________
EDIT: I didn't like my old signature
Reply with quote
bair
Beginner


Joined: 31 Oct 2006
Posts: 22

PostPosted: Fri Dec 01, 2006 5:10 am   
 
thanks a lot, looks like a lot of work. not working too well though i dunno if i messed it up but i have nowhere where to start looking. some responses:

You receive 8623 experience points. (-8697 exp/minute)


and when i type xpm after i typed xpm start:
61011 exp gained in 106 / 60) minutes = -10168 exp/minute

when i put all the stuff in an alias it gave me 2 syntax errors and i had to replace 2 braces, and this is what i ended up with as my code

Code:

#if (%null( %1)) {
  #noop no option provided, show current data
  #if (@XPPerMinute.starttime != -1) {#if (@XPPerMinute.endtime != -1) {#SAY @XPPerMinute.XPGained exp gained in %eval( (@XPPerMinute.EndTime - @XPPerMinute.StartTime) / 60) minutes = %eval( @XPPerMinute.XPGained /((@XPPerMinute.EndTime - @XPPerMinute.StartTime) / 60)) exp~/minute} {#SAY @XPPerMinute.XPGained exp gained in %eval( (%secs / 1000) - @XPPerMinute.StartTime) / 60) minutes = %eval( @XPPerMinute.XPGained /((@XPPerMinute.EndTime - @XPPerMinute.StartTime) / 60)) exp~/minute}}
  } {
  #noop option provided, determine what to do
  #if (%ismember( %1, "start|end|reset")) {
    #noop is valid option
    #case %ismember( %1, "start|reset|end") {
      #noop start
      XPPerMinute.starttime = %eval( %secs / 1000)
      XPPerMinute.endtime = -1
      XPPerMinute.XPGained = 0
      } {
      #noop end
      XPPerMinute.EndTime = %eval( %secs / 1000)
      #SAY @XPPerMinute.XPGained exp gained in %eval( (@XPPerMinute.EndTime - @XPPerMinute.StartTime) / 60) minutes = %eval( @XPPerMinute.XPGained /((@XPPerMinute.EndTime - @XPPerMinute.StartTime) / 60)) exp~/minute
      XPPerMinute.StartTime = -1
      XPPerMinute.EndTime = -1
      XPPerMinute.XPGained = 0
      }
    } {
    #noop is not valid option, show syntax
    #say USAGE: xpm ~[start|reset|end~]
    }
  }
Reply with quote
pvnarc
Newbie


Joined: 28 Aug 2004
Posts: 7

PostPosted: Fri Dec 01, 2006 8:31 am   
 
i play the same mud as bair and it seems like the math is wrong somewhere in the formula. ive been looking over it but cant quite find it but everything works except for the final exp/minute value, which is incorrectly calculated
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