ExpMon.mac (experience report pr. min / pr. hour)

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

NotHere
a lesser mummy
a lesser mummy
Posts: 40
Joined: Fri Jan 09, 2004 5:59 am

ExpMon.mac (experience report pr. min / pr. hour)

Post by NotHere » Sat Feb 21, 2004 1:23 am

This script is a simple one based on some code posted by daerck in the Macro Request forum.

I use it when slacking in exp groups. I have been unable to test the report for normal exp, since I only do AAs these days. Please lemme know (or post a fix), if it doesn't work.

Code: Select all

|======================================================================| 
| ExpMon.mac                                                           | 
|                                                                      | 
| Version:    1.0                                                      | 
| Date:       21 Feb 2004                                              | 
| Created by: NotHere - Based on code by daerck                        | 
|                                                                      | 
| Usage:      Expmon <interval>                                        |
|                                                                      | 
| Displays a report every <interval> minutes containing:               |
|  - current LVL and AA experience                                     |
|   - How much was earned since last report                            |
|   - How much was earned pr. minute                                   |
|   - How much would be earned on an hour at the current rate          |
|                                                                      | 
| If no interval is given, it will default to 10 minutes               | 
|                                                                      | 
|======================================================================| 

Sub Main 
  /declare ReportInterval Global
  /declare Report Timer
  /declare StartLvlExp Global 
  /declare StartLvl Global 
  /declare StartAAExp Global 
  /declare StartAA Global 
  
  /if $defined(Param0)==true { 
     /varset ReportInterval @Param0
  } else { 
     /varset ReportInterval 10
  } 

  /varset StartLvlExp $char(exp) 
  /varset StartLvl $char(level) 
  /varset StartAAExp $char(aa,exp) 
  /varset StartAA $char(aa,points) 
  /varset Report $calc(@ReportInterval*600)
 
  /echo [$time()] ExpMon running. Will report every @ReportInterval minute(s)

  :Start 
  /doevents 
  /goto :Start 
/return 

Sub Event_Timer() 
  /declare LVLearned local
  /declare AAearned local
  /varset LVLearned $calc($calc($char(exp)-@StartLvlExp)+$calc($calc($char(level)-@StartLvl)*100))
  /varset AAearned $calc($calc($char(aa,exp)-@StartAAExp)+$calc($calc($char(aa,points)-@StartAA)*100))

  /echo -----------------------------------------------------------
  /echo [$time()] LVL: $char(exp) (@LVLearned%, $calc(@LVLearned/@ReportInterval)%/min , $calc($calc(@LVLearned/@ReportInterval)*60)%/hr)
  /echo [$time()] AA: $char(aa,exp) (@AAearned%, $calc(@AAearned/@ReportInterval)%/min , $calc($calc(@AAearned/@ReportInterval)*60)%/hr)

  /varset Report $calc(@ReportInterval*600)
  /varset StartLvlExp $char(exp) 
  /varset StartLvl $char(level) 
  /varset StartAAExp $char(aa,exp) 
  /varset StartAA $char(aa,points) 
/return
NotHere
/afk

rzmonk76
a hill giant
a hill giant
Posts: 165
Joined: Sat Jan 31, 2004 1:37 pm
Contact:

nice

Post by rzmonk76 » Sat Feb 21, 2004 1:10 pm

if this works its a godsend. post in the snipets section when its bugfree too

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Sat Feb 21, 2004 5:30 pm

Aye, this would be a nice little add-on to many mac's.


Would also like to see Group and Raid Leadership added to it...
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

blamstick
orc pawn
orc pawn
Posts: 27
Joined: Sat Sep 06, 2003 6:50 pm

Post by blamstick » Mon Feb 23, 2004 3:47 am

Nice. Only way I would improve it would be to output the report to a log file as well. Just do /mqlog as well as /echo to save the info to a log file.

rzmonk76
a hill giant
a hill giant
Posts: 165
Joined: Sat Jan 31, 2004 1:37 pm
Contact:

question

Post by rzmonk76 » Mon Feb 23, 2004 12:31 pm

i placed this in my favorate meling macro and it kinda spams the window every second. not every 10 minutes by default.

question. is there supposed to be any #event "exeriance!!" attached to this as well? what calls the sub event_timer() ?

Boredbard
a ghoul
a ghoul
Posts: 89
Joined: Thu Nov 27, 2003 11:49 am

Post by Boredbard » Mon Feb 23, 2004 1:44 pm

The reason you get spammed (and the reason I got spammed when i tried this) is because you have another timer in your macro. Every time the timer comes up it calls the Event_Timer. Trying to figgure a work around right now. :wink:

daerck
a ghoul
a ghoul
Posts: 134
Joined: Mon Jan 12, 2004 8:44 pm

Post by daerck » Mon Feb 23, 2004 10:22 pm

You forgot the "m" for the default interval. The code you posted would set the timer to 10 tenth of a second = 1 second. So apply the changes in red

Code: Select all

/if $defined(Param0)==true { 
     /varset ReportInterval [color=red]$calc(@Param0*600)[/color]
} else { 
     /varset ReportInterval 10[color=red]m[/color] 
} 
And the issue with other timers can be solved like this

Code: Select all

Sub Event_Timer() 
[color=red]/if "@Param0"=="ReportInterval" {
[/color]
  /declare LVLearned local 
  /declare AAearned local 
  /varset LVLearned $calc($calc($char(exp)-@StartLvlExp)+$calc($calc($char(level)-@StartLvl)*100)) 
  /varset AAearned $calc($calc($char(aa,exp)-@StartAAExp)+$calc($calc($char(aa,points)-@StartAA)*100)) 

  /echo ----------------------------------------------------------- 
  /echo [$time()] LVL: $char(exp) (@LVLearned%, $calc(@LVLearned/@ReportInterval)%/min , $calc($calc(@LVLearned/@ReportInterval)*60)%/hr) 
  /echo [$time()] AA: $char(aa,exp) (@AAearned%, $calc(@AAearned/@ReportInterval)%/min , $calc($calc(@AAearned/@ReportInterval)*60)%/hr) 

  /varset Report $calc(@ReportInterval*600) 
  /varset StartLvlExp $char(exp) 
  /varset StartLvl $char(level) 
  /varset StartAAExp $char(aa,exp) 
  /varset StartAA $char(aa,points) 
[color=red]}[/color]
/return
This is from a first glance at the code without testing.

NotHere
a lesser mummy
a lesser mummy
Posts: 40
Joined: Fri Jan 09, 2004 5:59 am

Post by NotHere » Tue Feb 24, 2004 12:38 am

daerck wrote:You forgot the "m" for the default interval. The code you posted would set the timer to 10 tenth of a second = 1 second. So apply the changes in red

Code: Select all

     /varset ReportInterval 10[color=red]m[/color] 
And the issue with other timers can be solved like this

Code: Select all

  /echo [$time()] LVL: $char(exp) (@LVLearned%, $calc(@LVLearned/@ReportInterval)%/min , $calc($calc(@LVLearned/@ReportInterval)*60)%/hr) 
This is from a first glance at the code without testing.
The reason for not using m in the timer, and rather multiplying it into the correct milliseconds, is that when I first tried your script, it wouldnt parse if you use a timer var (ReportInterval) inside the division I do above.

Thats why I introduced a second var (Report), being the actual timer, that is calculated based on ReportInteval*600
NotHere
/afk

daerck
a ghoul
a ghoul
Posts: 134
Joined: Mon Jan 12, 2004 8:44 pm

Post by daerck » Tue Feb 24, 2004 3:15 pm

Ok, I missed that part and assumed ReportInterval was your timer.

So, don't use my changes to the ReportInterval part and in the Sub Event_Timer use /if "@Param0"=="Report". That should only fire of the exp-report if the the Report timer triggered, and therefore solve the spamming problems when using other timers in the script.

rzmonk76
a hill giant
a hill giant
Posts: 165
Joined: Sat Jan 31, 2004 1:37 pm
Contact:

Post by rzmonk76 » Sat Feb 28, 2004 6:12 pm

/if "@Param0"=="ReportInterval" { ~ }

or

/if "@Param0"=="Report" { ~ }

or

/if "@Param0"=="Report"

can you clean up your past erronous posts please?

daerck
a ghoul
a ghoul
Posts: 134
Joined: Mon Jan 12, 2004 8:44 pm

Post by daerck » Sat Feb 28, 2004 9:00 pm

Anytime a timer fires it basically calls the Event_Timer like this

Code: Select all

/call Event_Timer "NameOfTheTimer" "OriginalValueOfTheTimer"
So, if you only want a certain code to be executed of when a certain timer fires, you check @Param0 for the name of the timer.

In other words

Code: Select all

/if "@Param0"=="Report" { ~ } 
is correct for the code above.


Note: you can remove the ReportInterval var completely as you could use @Param1 for the calculations, though the current code probably allows for greater readibility. Matter of taste, I guess.

n00bie
orc pawn
orc pawn
Posts: 26
Joined: Sun Feb 29, 2004 3:21 pm

Post by n00bie » Sun Feb 29, 2004 3:23 pm

I changed it so that it would report the last 10 minutes in the first number, then a cumulative average after that, instead of just the last 10 minutes. It should give a more accurate xp/hour now.

Code: Select all

|======================================================================| 
| ExpMon.mac                                                           | 
|                                                                      | 
| Version:    1.0                                                      | 
| Date:       21 Feb 2004                                              | 
| Created by: NotHere - Based on code by daerck                        | 
|                                                                      | 
| Usage:      Expmon <interval>                                        | 
|                                                                      | 
| Displays a report every <interval> minutes containing:               | 
|  - current LVL and AA experience                                     | 
|   - How much was earned since last report                            | 
|   - How much was earned pr. minute                                   | 
|   - How much would be earned on an hour at the current rate          | 
|                                                                      | 
| If no interval is given, it will default to 10 minutes               | 
|                                                                      | 
|======================================================================| 

Sub Main 
  /declare ReportInterval Global 
  /declare Report Timer 
  /declare StartLvlExp Global 
  /declare StartLvl Global 
  /declare StartAAExp Global 
  /declare StartAA Global 
  /declare LastAAExp Global
  /declare LastLvlExp Global
  /declare TotalLVLearned Global
  /declare TotalAAearned Global
  /declare Counter Global
  
  /if $defined(Param0)==true { 
     /varset ReportInterval @Param0 
  } else { 
     /varset ReportInterval 10
  } 
  /varset Counter 1
  /varset StartLvlExp $char(exp) 
  /varset StartLvl $char(level) 
  /varset LastLvlExp $char(exp)
  /varset LastAAExp $char(aa,exp)
  /varset StartAAExp $char(aa,exp) 
  /varset StartAA $char(aa,points) 
  /varset Report $calc(@ReportInterval*600) 

  /echo [$time()] ExpMon running. Will report every @ReportInterval minute(s) 

  :Start 
  /doevents 
  /goto :Start 
/return 

Sub Event_Timer() 
  /declare LVLearned local 
  /declare AAearned local 
  /varset TotalLVLearned $calc($calc($char(exp)-@StartLvlExp)+$calc($calc($char(level)-@StartLvl)*100)) 
  /varset TotalAAearned $calc($calc($char(aa,exp)-@StartAAExp)+$calc($calc($char(aa,points)-@StartAA)*100)) 
  /varset LVLearned $calc($calc($char(exp)-@LastLvlExp)+$calc($calc($char(level)-@StartLvl)*100)) 
  /varset AAearned $calc($calc($char(aa,exp)-@LastAAExp)+$calc($calc($char(aa,points)-@StartAA)*100)) 
   
  /echo ----------------------------------------------------------- 
  /echo [$time()] LVL: $char(exp) (@LVLearned%, $calc(@TotalLVLearned/$calc(@ReportInterval*@Counter))%/min , $calc($calc(@TotalLVLearned/$calc(@ReportInterval*@Counter))*60)%/hr) 
  /echo [$time()] AA: $char(aa,exp) (@AAearned%, $calc(@TotalAAearned/$calc(@ReportInterval*@Counter))%/min , $calc($calc(@TotalAAearned/$calc(@ReportInterval*@Counter))*60)%/hr) 

  /varset Report $calc(@ReportInterval*600) 
  /varset LastLvlExp $char(exp) 
|  /varset StartLvl $char(level) 
  /varset LastAAExp $char(aa,exp) 
|  /varset StartAA $char(aa,points) 
  /varadd Counter 1
/return