General Tracking timers for debuffs
Reply
Tracking timers for debuffs
Do any of you have a good suggestion for tracking timers on debuffs? I know I can set a timer in the sub where it is cast, but then how would I handle resetting that timer when the mob dies.

MQ2CastTimer seems like it would handle all this, but it doesn't seem to be part of MQ2Emulator.

I'm on The Hidden Forest, so as far as I know, checking for something like
Macro
More +
${Spawn[${NetBots[${tank}].TargetID}].Type.Equal[CORPSE]}
wouldn't work.

I've got this macro healing, cannibalizing, and keeping combat proc on melee/pets, but I want to be able to slow as well, and this is a conundrum for me.
Mon Feb 24, 2014 2:13 am
Use an event to watch for the wore off message and then reset the timer.

Or track the mobs (by spawn id) you cast the debuff on in a variable
User an event to look for the you gained XP message and then in that event, check if the spawn id is down and reset the timer.
_________________
Sorvani
Mon Feb 24, 2014 3:19 am
Senior Project Member
Ok, this was my attempt at a sub to cast slow on the tanks target
Macro
More +
Sub Slow
/if (${Me.PctMana}<30 || ${Me.Moving}) /return
/if (${slowTimer}==0) /varset slowTarget 0
/if ( ${Spawn[${NetBots[${tank}].TargetID}].Type.Equal[NPC]} && ${NetBots[${tank}].TargetID}!=${slowTarget} && ${NetBots[${tank}].Attacking} && ${NetBots[${tank}].TargetHP}<97 && ${NetBots[${tank}].TargetHP}>60 ) {
        /casting ${slow} gem${slowGem} -maxtries|4 -targetid|${NetBots[${tank}].TargetID}
        /g Attempting to slow << ${Target.CleanName} >>
        /if ( ${Cast.Return[CAST_SUCCESS]} ) {
                /g << ${Target.CleanName} >> successfully slowed!
                /varset slowTarget ${NetBots[${tank}].TargetID}
                /varset slowTimer 150s
                /return
        }
        /if ( ${Cast.Return[CAST_RESIST]} ) {
                /g << ${Target.CleanName} >> resisted ${slow}, trying again.
                /casting ${slow} gem${slowGem} -maxtries|4 -targetid|${NetBots[${tank}].TargetID}
                /if ( ${Cast.Return[CAST_SUCCESS]} ) {
                        /g << ${Target.CleanName} >> successfully slowed!
                        /varset slowTarget ${NetBots[${tank}].TargetID}
                        /varset slowTimer 150s
                        /return
                }
                /if ( !${Cast.Return[CAST_RESIST]} ) {
                        /g << ${Target.CleanName} >> couldn't be slowed, moving on.
                        /varset slowTarget ${NetBots[${tank}].TargetID}
                        /varset slowTimer 300s
                        /return
                }
        }
        /if ( ${Cast.Return[CAST_TAKEHOLD]} ) {
                /g << ${Target.CleanName} >> couldn't be slowed, moving on.
                /varset slowTarget ${NetBots[${tank}].TargetID}
                /varset slowTimer 300s
                /return
        }
}
/return


slowTarget is declared, and slowTimer was added in to make sure that the slowTarget gets cleared eventually, even if slowTarget for some reason doesn't clear naturally.

Might be good to somehow turn slowTarget into an array, but I'm not sure how to handle timing out of the data that I put into it.

The error I ran into with this, is that MQ2 didn't like the ${Cast.Return[CAST_SUCCESS]}, that errored and exited the macro.

When I do /echo ${Cast.Return} I get CAST_SUCCESS. If the spell is interrupted it returned CAST_SUCCESS. When the spell was resisted it returned CAST_SUCCESS. am I using it wrong? does this require spell_routines.inc? I noticed in the wiki that the ${Cast.Return} is part of MQ2data, which isn't in the emu build. what do?

thanks.

I'm fairly happy with the rest of this macro. Especially the sub to keep Panther up on melees and pets :)

I use this for resetting the slowTarget and slowTimer vars
Macro
More +
Sub Event_Exp
        /if ( !${Spawn[${slowTarget}]} ) {
                /varset slowTarget 0
                /varset slowTimer 0s
        }
        /if ( !${Spawn[${crippleTarget}]} ) {
                /varset crippleTarget 0
                /varset crippleTimer 0s
        }
        if ( !${Spawn[${dotTarget}]} ) {
                /varset dotTarget 0
                /varset dotTimer 0s
        }
       
Sub Event_SlowOff
        /if ( !${Spawn[${slowTarget}]} ) {
                /varset slowTarget 0
                /varset slowTimer 0s
        }
Tue Feb 25, 2014 9:11 am
Maybe ${Cast.Result} is what I need to look at...
Tue Feb 25, 2014 10:11 am
Yes, Cast.Result is better.

string ${Cast.Result}
Returns a string containing the result of the /casting command. It can be one of the following:

CAST_CANCELLED: Casting was aborted
CAST_COLLAPSE: Your Gate collapsed
CAST_DISTRACTED: You were distracted
CAST_FIZZLE: Your cast fizzled
CAST_INTERRUPTED: Casting was interupted
CAST_INVISIBLE: You are invisible
CAST_NOTARGET: No target
CAST_NOTREADY: Not ready to cast
CAST_OUTOFMANA: Not enough mana to cast spell
CAST_OUTOFRANGE: Target is out of range
CAST_OUTDOORS: Spell not working here (on mount ect..)
CAST_PENDING: Casting is in progress
CAST_RECOVER: Spell is not ready
CAST_RESIST: Cast was resisted
CAST_STANDING: Not standing
CAST_STUNNED: You are stunned
CAST_SUCCESS: The cast was a success
CAST_TAKEHOLD: The spell did not take hold
CAST_CANNOTSEE: Cannot see target
CAST_COMPONENTS: Missing Component
CAST_ABORTED: Casting Aborted (/interrupt)
CAST_UNKNOWN: Unknown Spell


There was a similar issue reported earlier. I think the fix was found but because it may have been server specific, might not have been pushed to everyone. Would you mind reading that thread and following some of the testing steps? Also report client, MQ2 version, server, etc.
Wed Feb 26, 2014 12:25 am
Senior Project Member
General Tracking timers for debuffs
Reply