Countexp.mac

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

Dregs
orc pawn
orc pawn
Posts: 20
Joined: Tue Dec 29, 2009 9:57 am

Countexp.mac

Post by Dregs » Fri Jan 01, 2010 12:18 am

This is a complete macro version of the updated exp calculation code I threw together. As usual, if anyone noticed any problems with it, please let me know. It's hard to test some of the conditions in there due to the rarity that they occur.

Code: Select all

|Countexp.mac Version 1.0
|Written by Dregs
|Based on exp-calculating code from the rogue helper macro
|------------------------------------------------------------------------------
|Usage: Simply start the macro by typing /macro countexp
|------------------------------------------------------------------------------

#event GroupExp "#*#You gain party experience#*#"
#event SoloExp "#*#You gain experience#*#"

Sub Main
   /declare MobsKilled int outer 0
   /declare LDExp float outer ${Me.PctGroupLeaderExp} 
   /declare AAExp float outer ${Me.PctAAExp} 
   /declare Exp float outer ${Me.PctExp}
   /declare CurrentAA int outer ${Me.AAPointsTotal}
   /declare CurrentLevel int outer ${Me.Level}
   /declare CurrentLeaderPoints int outer ${Me.GroupLeaderPoints}
   /echo CountExp macro begun. Will count exp gained per mob killed.
   :Loop
   /doevents
   /goto :Loop
/return

Sub Event_GroupExp
   /varcalc MobsKilled (1+${MobsKilled})
   /if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Group XP: REG (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%)
   }
   /if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Group XP: REG (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%) 
   }
   /if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Group XP: Reg (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%
   }
   /if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Group XP: Reg (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%
   }
   /if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Group XP: Reg (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%
   }
   /if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Group XP: REG (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%) 
   }
   /if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Group XP: Reg (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%
   }
   /if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Group XP: Reg (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%
   }
   /varset CurrentAA ${Me.AAPointsTotal}
   /varset CurrentLevel ${Me.Level}
   /varset CurrentLeaderPoints ${Me.GroupLeaderPoints}
   /varset LDExp ${Me.PctGroupLeaderExp} 
   /varset AAExp ${Me.PctAAExp} 
   /varset Exp ${Me.PctExp}
/return

Sub Event_SoloExp
   /varcalc MobsKilled (1+${MobsKilled})
   /if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Solo XP: REG (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%)
   }
   /if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Solo XP: REG (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%) 
   }
   /if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Solo XP: Reg (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%
   }
   /if (${Me.Level}>${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Solo XP: Reg (${Math.Calc[100+${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%
   }
   /if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Solo XP: Reg (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%
   }
   /if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Solo XP: REG (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%) 
   }
   /if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}==${CurrentAA} && ${Me.GroupLeaderPoints}>${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Solo XP: Reg (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[100+${Me.PctGroupLeaderExp}-${LDExp}]}%
   }
   /if (${Me.Level}==${CurrentLevel} && ${Me.AAPointsTotal}>${CurrentAA} && ${Me.GroupLeaderPoints}==${CurrentLeaderPoints}) {
      /echo Kill number ${MobsKilled} yielded Solo XP: Reg (${Math.Calc[${Me.PctExp}-${Exp}]}%), AA (${Math.Calc[100+${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%
   }
   /varset CurrentAA ${Me.AAPointsTotal}
   /varset CurrentLevel ${Me.Level}
   /varset CurrentLeaderPoints ${Me.GroupLeaderPoints}
   /varset LDExp ${Me.PctGroupLeaderExp} 
   /varset AAExp ${Me.PctAAExp} 
   /varset Exp ${Me.PctExp}
/return

Dregs
orc pawn
orc pawn
Posts: 20
Joined: Tue Dec 29, 2009 9:57 am

Post by Dregs » Fri Jan 01, 2010 12:23 am

Here is version 2.0 which is basically just to show how to use the include file which I posted here:
http://macroquest2.com/phpBB2/viewtopic.php?t=16598

Code: Select all

|Countexp.mac Version 2.0
|Written by Dregs
|Based on exp-calculating code from the rogue helper macro
|------------------------------------------------------------------------------

#include CountExp.inc
Sub Main
   /declare MobsKilled int outer 0
   /declare LDExp float outer ${Me.PctGroupLeaderExp} 
   /declare AAExp float outer ${Me.PctAAExp} 
   /declare Exp float outer ${Me.PctExp}
   /declare CurrentAA int outer ${Me.AAPointsTotal}
   /declare CurrentLevel int outer ${Me.Level}
   /declare CurrentLeaderPoints int outer ${Me.GroupLeaderPoints}
   /echo Macro begun. Will start counting exp gained per kill.
   :Loop
   /doevents
   /goto :Loop
/return

Dregs
orc pawn
orc pawn
Posts: 20
Joined: Tue Dec 29, 2009 9:57 am

Post by Dregs » Mon Jan 25, 2010 11:47 am

Here is version 3.0, which shows how to use CountExp.inc (version 2.0) which can be found at http://macroquest2.com/phpBB2/viewtopic ... 574#147574

Code: Select all

|Countexp.mac Version 3.0
|Written by Dregs
|------------------------------------------------------------------------------

#include CountExp.inc
Sub Main
   /call CreateCountExpVariables
   /echo Macro begun. Will start counting exp gained per kill.
   :Loop
   /doevents
   /goto :Loop
/return

matadormix
a ghoul
a ghoul
Posts: 132
Joined: Sun Dec 14, 2008 8:31 am

Post by matadormix » Mon Jan 25, 2010 1:34 pm

Just for completenes sake, you may want to include "You gain raid experience" in that one (not that anyone raids for exp).

Dregs
orc pawn
orc pawn
Posts: 20
Joined: Tue Dec 29, 2009 9:57 am

Post by Dregs » Wed Feb 03, 2010 8:01 am

I appreciate the advice. I must admit I didn't think of that one. Also, I considered maybe calculating leadership exp on its own, but then I realized that you can't get any leadership exp without another message as well... as far as I know. I'm working on a few other things right now, but I'm hoping at some point to post another version which will also work as a before/after for shrouded exp, but that's proving more difficult than I expected. My brain is not working so well for math these days. :P

xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Countexp.mac

Post by xyilla » Tue Sep 16, 2025 3:37 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Countexp.mac

Post by xyilla » Tue Sep 16, 2025 3:38 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Countexp.mac

Post by xyilla » Tue Sep 16, 2025 3:39 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Countexp.mac

Post by xyilla » Tue Sep 16, 2025 4:16 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Countexp.mac

Post by xyilla » Tue Sep 16, 2025 4:17 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Countexp.mac

Post by xyilla » Tue Sep 16, 2025 4:19 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Countexp.mac

Post by xyilla » Tue Sep 16, 2025 4:20 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Countexp.mac

Post by xyilla » Tue Sep 16, 2025 4:21 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Countexp.mac

Post by xyilla » Tue Sep 16, 2025 4:22 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Countexp.mac

Post by xyilla » Tue Sep 16, 2025 4:23 am