Timers

freewilly

Lifetimer
Joined
Sep 20, 2006
Messages
191
Reaction score
23
Points
18
Ok, I'm being lazy, so if no one provides any input then fine, I'll slog through it. I'm looking to set a timer in one of my macros that clears a target if after tagging them they do not return to camp with me after so many seconds/minutes. This is to account for those mobs that like to shoot off in the opposite direction of you after tagging them. I find my AFK macro sometimes gets stuck on a mob that does this, and the mob never comes to the camp. I'm thinking some /varcalc's will need to occur, just not sure how/where to start with this.
 
My understanding is limited, but without seeing your macro/pull routine etc it's hard for anyone to just hand over a answer.


But yes, you'd need a local timer during a sub that gets called after attempting to pull.

Depending how complex/simple the macro/include you use for pulling is will depend on how hard it is to add it in without rewriting too much is my guess.
 
Yes, I understand my post may have been a bit vague, but I think I am just looking for conceptual guides. I'm being lazy not working this out for myself, but if someone can provide a snippet of code that achieves the basic idea I think I can run with it from there.
 
Code:
Sub WaitingForMob
	/declare WaitingTimer		timer local 0s
	
		/echo Waiting for aggro'd mob and waiting ${WaitingTimer} seconds
		
		/varset WaitinTimer 10s
		/varset PullMode waiting
		/doevents

		:WaitingForMob
			/call AggroCheck
			
		/if (${AddCount} > 0) {
			/varset PullMode NULL
				/call CombatSub

			}
		else {
		/if (${WaitingTimer}) /goto :WaitingForMob
		/echo Waiting for mob - None turned up!
		/varset PullMode NULL
			}
/return


PullMode/AddCount would be something declared at the start of the macro/include globally.

This sub would be called when your pull routine returns to a camp location, so you get back to camp. Set a timer, set pull mode, do your events, then begin waiting for a mob, checks for for adds (another sub I would imagine you'd have?) if you have adds set pullmode off and begin your combat routine, if no adds checks, checks if your timer is up and if it isn't it waits still and checks for adds etc, if timer is up it just sets pulling to null and then returns to start of macro.

No idea if this would work! Im still only in my early days of actually writing more then lines of stuff for holyshits :p
 
Logic something like:
define global variables:pulledMobID,pulltimer
On a pull add ${Target.ID} to ${PulledMobID} and set a timed variable to 15s ${pulltimer} within your pull subroutine right before the "/return"

When back in camp make a call to a checkpulledmob subroutine from whichever subroutine your macro sits in waiting for the mob to get in camp:
/if (${PulledMobID} && !${pulltimer}) /call checkpulledmob



sub checkpulledmob
/define local variable isincamp bool FALSE
/make a nearestspawn search within camp radius of all npc ids LOS to an array
/foreach array member {
/if (arraycurrentcontext.npc.id = ${PulledMobID}) /varset isincamp TRUE
}
/if (!${isincamp}) /target clear
reset your variables: PulledMobID and pulltimer
/return



That is obviously very dirty. I'm at work and not looking up the full,correct syntax, but I would start with something like that logic flow/thinking.
The 15second timer is just a guess if how long you expect the tagged mob to be back in camp. Increase the time as needed.


Edit (think this should now be correct):
Code:
(Put in main declare section)
/declare PulledMobID int outer
/declare pulltimer timer outer


(At end of pull subroutine)
/varset PulledMobID ${Target.ID}
/varset pulltimer 15s


(Put this in subroutine where your puller sits in waiting for mob to get to camp)
/if (${PulledMobID} && !${pulltimer}) /call checkpulledmob


sub checkpulledmob
    /declare Mobs int local
    /declare MobID int local
    /declare isincamp bool local false

    /if (${SpawnCount[npc los Range 5 150 radius 50 zradius 40 targetable]}) { 
	    /varset Mobs ${SpawnCount[npc los Range 5 150 radius 50 zradius 40 targetable]} 
	    /for i  1 to ${Mobs} 
	        /varset MobID ${NearestSpawn[${i}, npc los Range 5 150 radius 50 zradius 50 targetable].ID} 
	        /if (${MobID}=${PulledMobID}) /varset isincamp TRUE
    
    
        /next i
    }
    /if (!${isincamp}) /target clear
    /varset PulledMobID 0
    /varset pulltimer 0
/return
 
Last edited:
Code:
(Put in main declare section)
/declare PulledMobID int outer
/declare pulltimer timer outer


(At end of pull subroutine)
/varset PulledMobID ${Target.ID}
/varset pulltimer 15s


(Put this in subroutine where your puller sits in waiting for mob to get to camp)
/if (${PulledMobID} && !${pulltimer}) /call checkpulledmob


sub checkpulledmob
    /declare Mobs int local
    /declare MobID int local
    /declare isincamp bool local false

    /if (${SpawnCount[npc los Range 5 150 radius 50 zradius 40 targetable]}) { 
	    /varset Mobs ${SpawnCount[npc los Range 5 150 radius 50 zradius 40 targetable]} 
	    /for i  1 to ${Mobs} 
	        /varset MobID ${NearestSpawn[${i}, npc los Range 5 150 radius 50 zradius 50 targetable].ID} 
	        /if (${MobID}=${PulledMobID}) /varset isincamp TRUE
    
    
        /next i
    }
    /if (!${isincamp}) /target clear
    /varset PulledMobID 0
    /varset pulltimer 0
/return

I'm still testing this, but thus far I've used your exact code and it appears to do exactly what I was wanting. Thank you.
 
just check if your target is more than 600 range away (the deaggro range) and if so, reset your pull function.
 
just check if your target is more than 600 range away (the deaggro range) and if so, reset your pull function.

So any and every time you get 600 range away from a mob they deagro? I never knew that. That certainly makes things a little easier.

But sometimes, for whatever reason, I have mobs within that range that just do not come back to camp. Not sure why as I am not at the keyboard when it occurs, thus a timed reset type sub is useful.
 
In case anyone is interested, apparently I was being pretty lazy with regards to setting timers. I merely declared a variable...

Code:
/declare pulltimer 			timer outer


Then in two of my subs where there could be a chance that a mob gets away I did something like this:

Code:
/varset pulltimer 5s

&

Code:
/if (${pulltimer} == 0) /keypress esc
 
You can optionally also use:

/if (!${pulltimer}) /keypress esc
 
just check if your target is more than 600 range away (the deaggro range) and if so, reset your pull function.
So any and every time you get 600 range away from a mob they deagro? I never knew that. That certainly makes things a little easier.

But sometimes, for whatever reason, I have mobs within that range that just do not come back to camp. Not sure why as I am not at the keyboard when it occurs, thus a timed reset type sub is useful.
There are a few zone wide aggro mechanisms on raids, but otherwise, yes.. 600 is the magic number for a mob deaggroing you.