An exp leech macro

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

An exp leech macro

Post by Dregs » Tue Dec 29, 2009 2:06 pm

This is a macro I wrote for having lower level toons follow around a high level character while he kills stuff. It simply follows someone around and calculates the exp gained per kill.

There are a few strange things with the exp calculation that I may fix later, but I'm still a bit new writing macros and wasn't quite sure how to tackle these problems yet. If you ding an AA, the calculation shows as negative. This is a bit odd, of course, but not a huge deal. Also, if you kill more than one mob before it updates, say they give 6% AA per kill, it will show up as one kill worth double the experience, 12%.

It's not totally amazing, but it will hopefully be useful for other people like me who like to find the best place for leveling up their alt on leach exp. If anyone finds any problems with it, or knows how to fix the exp calculation problems with more than one mob dying at a time, or dinging an AA, please let me know.

Code: Select all

|------------------------------------------------------------------------------------------------------
|Followexp version 1.0
|Written by Dregs
|The EXP calculation section is copied from the RogueHelper macro, with a few modifications
|------------------------------------------------------------------------------------------------------
|Usage:
|To follow your current target, simply type
|/macro Followexp
|
|To follow something other than your current target, enter the name of the character you wish to follow.
|Names are not case sensitive.
|Examples:
|/macro Followexp Sirtanksalot
|/macro Followexp sirtanksalot
|-------------------------------------------------------------------------------------------------------

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

Sub Main
   /declare FollowWho string outer
   /declare LDExp float outer ${Me.PctGroupLeaderExp} 
   /declare AAExp float outer ${Me.PctAAExp} 
   /declare Exp float outer ${Me.PctExp}
   /declare MobsKilled int outer 0
   /declare FeedbackTimer timer outer 0
   /if (!${Defined[Param0]} && !${Target.ID}) {
      /echo You must begin the macro with the name of the character you want to follow targeted, or supply that character's name as a parameter.
      /echo Example: /macro FollowExp Sirtanksalot
      /return
   }
   /if (${Defined[Param0]} && !${Spawn[PC ${Param0}].ID}) {
      /echo There seems to be no character in the zone matching the name you supplied.
      /echo Please restart the macro, making sure to enter the correct name.
      /echo Example: /macro Followexp sirtanksalot
      /return
   }
   /if (${Defined[Param0]} && ${Spawn[PC ${Param0}].ID}) {
      /varset FollowWho ${Param0}
      /target ${FollowWho}
      /delay 2s ${Target.ID}
      /if (!${Target.ID}) {
         /echo Targeting timed out. Please restart the macro.
         /return
      }
      /if (${Target.Name.NotEqual[${FollowWho}]}) {
         /if (${Target.ID}) {
            /echo A target was acquired, but it does not exactly match the name you supplied.
            /echo The macro will begin in 10 seconds, using your current target. If this is not desired, please press the Escape key to end the macro.
            /varset FeedbackTimer 10s
            :Feedback
            /if (${FeedbackTimer} && ${Target.ID}) {
               /goto :Feedback
            }
            /if (${Target.ID}) {
               /varset FollowWho ${Target.Name}
               /goto :Begin
            }
         }
      }
   }
   /if (${Target.ID}) {
      /varset FollowWho ${Target.Name}
   }
   :Begin
   /if (!${Target.ID}) /return
   /echo Following ${FollowWho}. Will calculate exp gained per kill.
   /echo You may end the macro at any time by pressing the Escape key.
   :Loop
      /doevents
      /if (${Target.Distance}>60) /keypress up hold
      /if (${Target.Distance}<40) /keypress up 
      /face fast
      /delay 2
   /if (${Target.ID} && ${Target.Name.Equal[${FollowWho}]}) /goto :Loop
   /keypress down
/return

Sub Event_GroupExp
   /varcalc MobsKilled (1+${MobsKilled})
   /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}]}%) 
   /varset LDExp ${Me.PctGroupLeaderExp} 
   /varset AAExp ${Me.PctAAExp} 
   /varset Exp ${Me.PctExp}
/return

Sub Event_SoloExp
   /varcalc MobsKilled (1+${MobsKilled})
   /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}]}%) 
   /varset LDExp ${Me.PctGroupLeaderExp} 
   /varset AAExp ${Me.PctAAExp} 
   /varset Exp ${Me.PctExp}
/return
Last edited by Dregs on Sun Jun 20, 2010 9:08 am, edited 1 time in total.

jpetrone
a lesser mummy
a lesser mummy
Posts: 70
Joined: Fri Dec 19, 2008 9:32 pm

Post by jpetrone » Thu Dec 31, 2009 9:52 am

I'm not sure how you would "fix it" but you're getting a negative calculation when you ding an aa because you are subtracting the amount of aa exp you had before you got the aa (Ie 80%) from the amount of aa exp you have now after you ding an aa (Ie 20%). So unless you're getting 100% or more aa exp per kill you're going to have less after the ding than you did before.

You basically answered the second problem yourself.
if you kill more than one mob before it updates
Again I'm not sure of the exact mechanics but I've run into similar behavior before. When you have a delay between checking for events in my experience you only get one trigger for multiple instances of the event, I'm guess its the last instance of the event. So when you're checking current now vs the last time it checked it looks like you got extra exp for a single kill vs possible multiple kills.

I don't know if that helps you figure out a solution or not but hopefully it at least makes sense :P

Cheers
j

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

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

Thanks for the feedback, jpetrone. I got it working now using an include file I made. The include file can be found at:
http://macroquest2.com/phpBB2/viewtopic.php?t=16598

I wasn't really sure as to the naming scheme of things. I guess since I actually simply corrected previous odd functionality, I shouldn't call this version 2.0. So maybe 1.1?

Here is version 1.1 which should be calculating exp per mob correctly when dinging an AA or leveling up, or gaining a leadership point, but it still will show two mobs dying at the same time as only one kill for a larger than normal amount of exp.

Code: Select all

|------------------------------------------------------------------------------------------------------
|Followexp version 1.1
|Written by Dregs
|------------------------------------------------------------------------------------------------------
|Usage:
|To follow your current target, simply type
|/macro Followexp
|
|To follow something other than your current target, enter the name of the character you wish to follow.
|Names are not case sensitive.
|Examples:
|/macro Followexp Sirtanksalot
|/macro Followexp sirtanksalot
|-------------------------------------------------------------------------------------------------------
#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
   /declare CurrentLevel int outer
   /declare CurrentLeaderPoints int outer
   /varset CurrentAA ${Me.AAPointsTotal}
   /varset CurrentLevel ${Me.Level}
   /varset CurrentLeaderPoints ${Me.GroupLeaderPoints}
   /declare FollowWho string outer
   /declare FeedbackTimer timer outer 0
   /if (!${Defined[Param0]} && !${Target.ID}) {
      /echo You must begin the macro with the name of the character you want to follow targeted, or supply that character's name as a parameter.
      /echo Example: /macro FollowExp Sirtanksalot
      /return
   }
   /if (${Defined[Param0]} && !${Spawn[PC ${Param0}].ID}) {
      /echo There seems to be no character in the zone matching the name you supplied.
      /echo Please restart the macro, making sure to enter the correct name.
      /echo Example: /macro Followexp sirtanksalot
      /return
   }
   /if (${Defined[Param0]} && ${Spawn[PC ${Param0}].ID}) {
      /varset FollowWho ${Param0}
      /target ${FollowWho}
      /delay 2s ${Target.ID}
      /if (!${Target.ID}) {
         /echo Targeting timed out. Please restart the macro.
         /return
      }
      /if (${Target.Name.NotEqual[${FollowWho}]}) {
         /if (${Target.ID}) {
            /echo A target was acquired, but it does not exactly match the name you supplied.
            /echo The macro will begin in 10 seconds, using your current target. If this is not desired, please press the Escape key to end the macro.
            /varset FeedbackTimer 10s
            :Feedback
            /if (${FeedbackTimer} && ${Target.ID}) {
               /goto :Feedback
            }
            /if (${Target.ID}) {
               /varset FollowWho ${Target.Name}
               /goto :Begin
            }
         }
      }
   }
   /if (${Target.ID}) {
      /varset FollowWho ${Target.Name}
   }
   :Begin
   /if (!${Target.ID}) /return
   /echo Following ${FollowWho}. Will calculate exp gained per kill.
   /echo You may end the macro at any time by pressing the Escape key.
   :Loop
      /doevents
      /if (${Target.Distance}>60) /keypress up hold
      /if (${Target.Distance}<40) /keypress up 
      /face fast
      /delay 2
   /if (${Target.ID} && ${Target.Name.Equal[${FollowWho}]}) /goto :Loop
   /keypress up
/return

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Fri Jan 01, 2010 10:33 am

One way to do multiple mobs dieing is to make an event for 'blah blah blah slain by blah blah blah' which would increment your number of mobs killed. Then in your calculation, figure out how many mobs you were at last time your ran the numbers and adjust from there.
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

FrankJScott
naggy
naggy
Posts: 2128
Joined: Sun Feb 19, 2023 7:11 am

Top Product Guide

Post by FrankJScott » Tue Jan 30, 2024 11:32 pm

Please try Google before asking about Recommended Product Blog c70_595

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

Re: An exp leech macro

Post by xyilla » Tue Sep 16, 2025 12:27 am


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

Re: An exp leech macro

Post by xyilla » Tue Sep 16, 2025 12:28 am


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

Re: An exp leech macro

Post by xyilla » Tue Sep 16, 2025 12:29 am


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

Re: An exp leech macro

Post by xyilla » Tue Sep 16, 2025 12:30 am


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

Re: An exp leech macro

Post by xyilla » Tue Sep 16, 2025 12:31 am


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

Re: An exp leech macro

Post by xyilla » Tue Sep 16, 2025 12:32 am


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

Re: An exp leech macro

Post by xyilla » Tue Sep 16, 2025 12:34 am


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

Re: An exp leech macro

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


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

Re: An exp leech macro

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


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

Re: An exp leech macro

Post by xyilla » Tue Sep 16, 2025 2:24 am