HUD timer debuff

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

Moderator: MacroQuest Developers

User avatar
Seagreen500
crash test
Posts: 47
Joined: Mon Nov 10, 2003 1:04 am

HUD timer debuff

Post by Seagreen500 » Sun May 09, 2004 12:44 pm

Code: Select all

|Revised May 10, 10:30am
| - added ini file support, HudTimer.ini (example below)
|
|Revised May 9, 12:30pm
| - Removes timer on death, if corpse exists or not 
|
|
| HuDTimer.mac
|
| This macro will react to spells cast on your target.
| It displays the time remaining on the spell cast,the
| spell cast, and the mob cast upon. 
|
| Currently it will display 5 debuffs at once.
| It will refresh any identical buff recast on the same mob
| It fills in timer slots from top to bottom as available
| Displays "timer list full" when max timers are running
|
| TODO:
|
| - dynamically create entries in the MQ2Hud.ini file to allow for more timers
| - revisit formatting spell duration (ticks) into time (hh:mm:ss)
| - write as HudTimer.inc and call from Personal.inc for genbot.
|
| by
| Seagreen
| 

#turbo 40

#Event Debuff |${Target.CleanName}|#*#

sub Main
	/declare counter int outer
	/declare DebuffSpell string outer
	/declare HudArrayTimer[5,5] string outer NULL
		| [1,x] 1. Ending time of debuff
		| [2.x] 2. Name of spell cast on npc
		| [3.x] 3. Long name of npc
		| [4.x] 4. ID of npc
		| [5.x] 5. Duration (formatted)

	/echo HuD DEBUFF Timer is now ACTIVE.
		
	:mainloop
		/doevents
		/call CheckTimer
		/delay 1
	/goto :mainloop
/return

Sub Event_Debuff(string Line)
	/declare DebuffText string local

	/varset counter 1
|
| CYCLE THROUGH INI ENTRIES, ALL ENTRIES WILL BE GREATER THAN NULL
|
	:iniloop
	/if (!${Ini[HudTimer.ini,Debuffs,${Ini[HudTimer.ini,Debuffs].Arg[${counter},|]}].Length}>NULL) /return
	/varset DebuffText ${Target.CleanName}${Ini[HudTimer.ini,Debuffs,${Ini[HudTimer.ini,Debuffs].Arg[${counter},|]}]}
|
| MATCH OUR INI DEBUFF TEXT WITH OUR EVENT TEXT
|
	/if (${DebuffText.Equal[${Line}]}) {
			/varset DebuffSpell ${Ini[HudTimer.ini,Debuffs].Arg[${counter},|]}
			/call SetupTimer
			/return
			}
	/varcalc counter ${counter}+1
	/goto :iniloop
/return

Sub SetupTimer
|
| IF SAME DEBUFF IS BEING RECAST ON EXISTING NPC IN TIMER ARRAY, REFRESH
|
	/for counter 1 to 5
	/if (${Spawn[${HudArrayTimer[4,${counter}]}].ID}==${Target.ID} && ${String[${HudArrayTimer[2,${counter}]}].Equal[${DebuffSpell}]}) {
 		/varset HudArrayTimer[1,${counter}] ${Math.Calc[${Time.SecondsSinceMidnight}+(${Spell[${DebuffSpell}].Duration}*6)]}
 	 	/varset HudArrayTimer[2,${counter}] ${DebuffSpell}
 		/varset HudArrayTimer[3,${counter}] ${Target}
 		/varset HudArrayTimer[4,${counter}] ${Target.ID}
		/return
	}
	/next counter
|
| SETUP NEW DEBUFF OF NPC IN OPEN SLOT
|
	/varset counter 1
	:counterloop
	/if (!${Spawn[${HudArrayTimer[4,${counter}]}].ID} && !(${Math.Calc[${HudArrayTimer[1,${counter}]}-${Time.SecondsSinceMidnight}].Int}>0)) {
 		/varset HudArrayTimer[1,${counter}] ${Math.Calc[${Time.SecondsSinceMidnight}+(${Spell[${DebuffSpell}].Duration}*6)]}
 	 	/varset HudArrayTimer[2,${counter}] ${DebuffSpell}
 		/varset HudArrayTimer[3,${counter}] ${Target}
 		/varset HudArrayTimer[4,${counter}] ${Target.ID}
	} else {
		/if (${counter}>4) {
			/echo Debuff timer slots are full
			/return
		}
		/varcalc counter ${counter}+1
		/goto :counterloop
		}
/return


Sub CheckTimer
	/declare duration int local
	/declare myhour string local
	/declare myminute string local
	/declare mysecond string local

  /for counter 1 to 5
	/if (!${Spawn[${HudArrayTimer[4,${counter}]}].State.Equal[DEAD]} && ${Math.Calc[${HudArrayTimer[1,${counter}]}-${Time.SecondsSinceMidnight}].Int}>0) {
|
| FORMAT DURATION TO 00:00:00
|	
		/varset duration ${Math.Calc[${HudArrayTimer[1,${counter}]}-${Time.SecondsSinceMidnight}].Int}
		/if (${duration}>3600) {
			/varset myhour ${Math.Calc[${duration}/3600].Int}
			/varset duration ${Math.Calc[((${duration}/3600)-${myhour})*3600]}
		} else {
			/varset myhour
		}
		/if (${duration}>60) {
			/varset myminute ${Math.Calc[${duration}/60].Int}
			/varset duration ${Math.Calc[((${duration}/60)-${myminute})*60]}
			/if (${myhour} && ${myminute}<10) /varset myminute 0${myminute}
		} else {
			/varset myminute
		}
		/if (${duration}) {
			/varset mysecond ${duration}
			/if (${myminute} && ${mysecond}<10) /varset mysecond 0${mysecond}
		} else {
			/varset mysecond
		}
|
| DISPLAY HH:MM:SS IF NEEDED
|
		/if (${myhour}) { 
			/varset HudArrayTimer[5,${counter}] ${myhour}:${myminute}:${mysecond}
		} else /if (${myminute}) {
			/varset HudArrayTimer[5,${counter}] ${myminute}:${mysecond}
		} else /if (${mysecond}) { 
			/varset HudArrayTimer[5,${counter}] ${mysecond} 
		}
	} else {
		/varset HudArrayTimer[1,${counter}]
		/varset HudArrayTimer[2,${counter}]
		/varset HudArrayTimer[3,${counter}]
		/varset HudArrayTimer[4,${counter}]
		/varset HudArrayTimer[5,${counter}]
		}
		
   /next counter
/return
Here is the MQ2Hud.ini (goes in your MQ2 directory)

Code: Select all

[Elements]
	GMIndicator=3,5,45,0,0,255,${Spawn[gm]}

	TargetInfo=3,300,10,255,255,255,${Target}

	HudTimer1=3,150,30,50,255,255,${HudArrayTimer[5,1]}
	HudSpell1=3,200,30,255,255,255,${HudArrayTimer[2,1]}
	HudTarget1=3,300,30,255,255,50,${HudArrayTimer[3,1]}

	HudTimer2=3,150,50,50,255,255,${HudArrayTimer[5,2]}
	HudSpell2=3,200,50,255,255,255,${HudArrayTimer[2,2]}
	HudTarget2=3,300,50,255,255,50,${HudArrayTimer[3,2]}

	HudTimer3=3,150,70,50,255,255,${HudArrayTimer[5,3]}
	HudSpell3=3,200,70,255,255,255,${HudArrayTimer[2,3]}
	HudTarget3=3,300,70,255,255,50,${HudArrayTimer[3,3]}

	HudTimer4=3,150,90,50,255,255,${HudArrayTimer[5,4]}
	HudSpell4=3,200,90,255,255,255,${HudArrayTimer[2,4]}
	HudTarget4=3,300,90,255,255,50,${HudArrayTimer[3,4]}

	HudTimer5=3,150,110,50,255,255,${HudArrayTimer[5,5]}
	HudSpell5=3,200,110,255,255,255,${HudArrayTimer[2,5]}
	HudTarget5=3,300,110,255,255,50,${HudArrayTimer[3,5]}

This is the new ini file, same directory as the HudTimer.mac

**NOTE**
Your ini text must be 'exactly' what is after your targets name.
IE: even spaces, This is to allow for 's after the target name.

Name this one HudTimer.ini

Code: Select all

[Debuffs]
Bliss="'s jaw falls as they begin to drool."
Forlorn Deeds=" slows down."
Howl of Tashan=" glances nervously about."
Brell's Stalwart Shield=" begins to radiate with divine strength."
Last edited by Seagreen500 on Mon May 10, 2004 4:44 pm, edited 1 time in total.

apollo5145
orc pawn
orc pawn
Posts: 26
Joined: Wed Feb 25, 2004 8:14 pm

Post by apollo5145 » Sun May 09, 2004 8:01 pm

Great macro idea, added a few extra spells to it for shams & enc's using diff mez's.

Code: Select all

| 
| HuDTimer.mac 
| 
| This macro will react to spells cast on your target. 
| It displays the time remaining on the spell cast,the 
| spell cast, and the mob cast upon. 
| 
| Currently it will display 5 debuffs at once. 
| It will refresh any identical buff recast on the same mob 
| It fills in timer slots from top to bottom as available 
| Displays timer list full when max timers are running 
| 
| TODO: 
| 
| - dynamically create entries in the MQ2Hud.ini file to allow for more timers 
| - read #Event information from an .ini file 
| - revisit formatting spell duration (ticks) into time (hh:mm:ss) 
| - write as HudTimer.inc and call from Personal.inc for genbot. 
| 
| by 
| Seagreen 
| 

#turbo 40 

#Event Malos "very uncomfortable" 
#Event Turgurs "yawns." 
#Event Root "to the ground" 
#Event Tash "glances nervously about."
#Event Bliss "begin to drool."
#Event Forlorn "slows down."
#Event Apathy "stares off into the distance."
#Event Sleep "falls asleep."
#Event Rapture "in raptured bliss."

sub Main 
   /declare counter int outer 
   /declare DebuffSpell string outer 
   /declare HudArrayTimer[5,5] string outer NULL 
      | [1,x] 1. Ending time of debuff 
      | [2.x] 2. Name of spell cast on npc 
      | [3.x] 3. Long name of npc 
      | [4.x] 4. ID of npc 
      | [5.x] 5. Duration (formatted) 

   /echo HuD DEBUFF Timer is now ACTIVE. 

   :mainloop 

   /doevents 
   /call CheckTimer 
   /delay 1 

   /goto :mainloop 
/return 

Sub Event_Tash
   /varset DebuffSpell Howl of Tashan
   /echo ${DebuffSpell}
   /call SetupTimer 
/return 

Sub Event_Rapture
   /varset DebuffSpell Rapture
   /echo ${DebuffSpell}
   /call SetupTimer 
/return 

Sub Event_Sleep
   /varset DebuffSpell Sleep
   /echo ${DebuffSpell}
   /call SetupTimer 
/return 

Sub Event_Apathy
   /varset DebuffSpell Apathy
   /echo ${DebuffSpell}
   /call SetupTimer 
/return 

Sub Event_Forlorn
   /varset DebuffSpell Forlorn Deeds
   /echo ${DebuffSpell}
   /call SetupTimer 
/return 

Sub Event_Bliss
   /varset DebuffSpell Bliss
   /echo ${DebuffSpell}
   /call SetupTimer 
/return 

Sub Event_Malos
   /varset DebuffSpell Malos
   /echo ${DebuffSpell}
   /call SetupTimer 
/return 

Sub Event_Turgurs 
   /varset DebuffSpell Turgur's Insects
   /echo ${DebuffSpell}
   /call SetupTimer 
/return 

Sub Event_Root
   /varset DebuffSpell Greater Immobilize
   /call SetupTimer 
/return 

Sub SetupTimer 
   /declare duration int local 

| 
| IF SAME DEBUFF IS BEING RECAST ON EXISTING NPC IN TIMER ARRAY, REFRESH 
| 
   /for counter 1 to 5 
   /if (${Spawn[${HudArrayTimer[4,${counter}]}].ID}==${Target.ID} && ${String[${HudArrayTimer[2,${counter}]}].Equal[${DebuffSpell}]}) { 
      /varset HudArrayTimer[1,${counter}] ${Math.Calc[${Time.SecondsSinceMidnight}+(${Spell[${DebuffSpell}].Duration}*6)]} 
       /varset HudArrayTimer[2,${counter}] ${DebuffSpell} 
      /varset HudArrayTimer[3,${counter}] ${Target} 
      /varset HudArrayTimer[4,${counter}] ${Target.ID} 
      /return 
   } 
   /next counter 

| 
| SETUP NEW DEBUFF OF NPC IN OPEN SLOT 
| 
   /varset counter 1 
   :counterloop 
   /if (!${Spawn[${HudArrayTimer[4,${counter}]}].ID} && !(${Math.Calc[${HudArrayTimer[1,${counter}]}-${Time.SecondsSinceMidnight}].Int}>0)) { 
      /varset HudArrayTimer[1,${counter}] ${Math.Calc[${Time.SecondsSinceMidnight}+(${Spell[${DebuffSpell}].Duration}*6)]} 
       /varset HudArrayTimer[2,${counter}] ${DebuffSpell} 
      /varset HudArrayTimer[3,${counter}] ${Target} 
      /varset HudArrayTimer[4,${counter}] ${Target.ID} 
   } else { 
      /if (${counter}>4) { 
         /echo Debuff timer slots are full 
         /return 
      } 
      /varcalc counter ${counter}+1 
      /goto :counterloop 
      } 
/return 


Sub CheckTimer 
   /declare duration int local 
   /declare myhour string local 
   /declare myminute string local 
   /declare mysecond string local 

  /for counter 1 to 5 
  
   /if (!${Spawn[${HudArrayTimer[4,${counter}]}].State.Equal[DEAD]} && ${Math.Calc[${HudArrayTimer[1,${counter}]}-${Time.SecondsSinceMidnight}].Int}>0) { 
| 
| FORMAT DURATION TO 00:00:00 
|    
      /varset duration ${Math.Calc[${HudArrayTimer[1,${counter}]}-${Time.SecondsSinceMidnight}].Int} 
      /if (${duration}>3600) { 
         /varset myhour ${Math.Calc[${duration}/3600].Int} 
         /varset duration ${Math.Calc[((${duration}/3600)-${myhour})*3600]} 
      } else { 
         /varset myhour 
      } 
      /if (${duration}>60) { 
         /varset myminute ${Math.Calc[${duration}/60].Int} 
         /varset duration ${Math.Calc[((${duration}/60)-${myminute})*60]}
         /if (${myhour} && ${myminute}<10) /varset myminute 0${myminute} 
      } else { 
         /varset myminute 
      } 
      /if (${duration}) { 
         /varset mysecond ${duration} 
         /if (${myminute} && ${mysecond}<10) /varset mysecond 0${mysecond}
      } else { 
         /varset mysecond 
      } 

| 
| DISPLAY HH:MM:SS IF NEEDED 
| 
      /if (${myhour}) { 
         /varset HudArrayTimer[5,${counter}] ${myhour}:${myminute}:${mysecond} 
      } else /if (${myminute}) { 
         /varset HudArrayTimer[5,${counter}] ${myminute}:${mysecond} 
      } else /if (${mysecond}) { 
         /varset HudArrayTimer[5,${counter}] ${mysecond} 
      } 
   } else { 
      /varset HudArrayTimer[1,${counter}] 
      /varset HudArrayTimer[2,${counter}] 
      /varset HudArrayTimer[3,${counter}] 
      /varset HudArrayTimer[4,${counter}] 
      /varset HudArrayTimer[5,${counter}] 
      } 
       
   /next counter 
/return 

Drumstix42
a grimling bloodguard
a grimling bloodguard
Posts: 808
Joined: Mon May 03, 2004 4:25 pm

Post by Drumstix42 » Sun May 09, 2004 11:04 pm

Could we get a screen shot? :)

DSD
decaying skeleton
decaying skeleton
Posts: 4
Joined: Fri May 07, 2004 3:06 pm

Post by DSD » Sun Jun 20, 2004 11:32 pm

This no longer works correct with the newst update. Line 173 is getting a non-numeric error, I love this macro, Any chance of getting a fix?

JKnec
decaying skeleton
decaying skeleton
Posts: 3
Joined: Sun Sep 05, 2004 12:39 pm

Post by JKnec » Sun Sep 05, 2004 12:42 pm

anyone working in this mac i greater mac for nec kiter and dont work.

thx if anyone work and reply solution for this mac.

in_training
Craptastic
Posts: 115
Joined: Fri Oct 10, 2003 8:25 am

Post by in_training » Sun Sep 05, 2004 11:53 pm

I think it's this line at 173:

Code: Select all

/if (${duration}>60) {
Should be

Code: Select all

/if (${duration}>60) {
I believe. the > is invalid. There was a post here a while back about WHAT the $gt; Needed to be changed to, however, I do not know where. Search for it.
Last edited by in_training on Mon Sep 06, 2004 11:26 am, edited 1 time in total.
[url=http://www.macroquest2.com/main.php?p=donate]Vote or Die!l[/url]

in_training
Craptastic
Posts: 115
Joined: Fri Oct 10, 2003 8:25 am

Post by in_training » Sun Sep 05, 2004 11:58 pm

Only newbs double-post.

Sorry y'all
[url=http://www.macroquest2.com/main.php?p=donate]Vote or Die!l[/url]

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Mon Sep 06, 2004 2:20 pm

I'm not sure how thoroughly tested this was but I was having a lot of issues, mostly with out it was dealing with Int's and the math calcs. When dealing with the seconds was when it got bad dividing for exampled 120 by 60 and using 3 instead of 3.5 was creating bad things.

Here's my simple fix of it (without getting too complicated). If there's more than 60 seconds on a debuff left, it will only show minutes, else only seconds. I don't know ANY debuffs that last any where even CLOSE to 1 hour, but whatever I left it in there.

-Dealing with seconds

Code: Select all

      /if (${duration}>=0) {
         /varset mysecond ${duration}
         /if (${myminute} && ${mysecond}<10) /varset mysecond 0${mysecond}
      } else {
         /varset mysecond 0
      }
-Dealing with showing of h/m/s. (changed from h:m:s)

Code: Select all

      /if (${myhour}) {
         /varset HudArrayTimer[5,${counter}] ${myhour}h
      } else /if (${myminute}) {
         /varset HudArrayTimer[5,${counter}] ${myminute}m
      } else /if (${mysecond}) {
         /varset HudArrayTimer[5,${counter}] ${mysecond}s
      }
Also, since I do not always this running, this is an optional fix for getting rid of all those NULL's that show in the MQ2HUD.ini:

Code: Select all

    HudTimer1=1,480,240,050,255,255,${If[${String[${HudArrayTimer[5,1]}].NotEqual["NULL"]},${HudArrayTimer[5,1]},]}
    HudSpell1=1,530,240,255,255,255,${If[${String[${HudArrayTimer[2,1]}].NotEqual["NULL"]},${HudArrayTimer[2,1]},]}
   HudTarget1=1,630,240,255,255,050,${If[${String[${HudArrayTimer[3,1]}].NotEqual["NULL"]},${HudArrayTimer[3,1]},]}
   
    HudTimer2=3,480,250,050,255,255,${If[${String[${HudArrayTimer[5,2]}].NotEqual["NULL"]},${HudArrayTimer[5,2]},]}
    HudSpell2=3,530,250,255,255,255,${If[${String[${HudArrayTimer[2,2]}].NotEqual["NULL"]},${HudArrayTimer[2,2]},]}
   HudTarget2=3,630,250,255,255,050,${If[${String[${HudArrayTimer[3,2]}].NotEqual["NULL"]},${HudArrayTimer[3,2]},]}

    HudTimer3=3,480,260,050,255,255,${If[${String[${HudArrayTimer[5,3]}].NotEqual["NULL"]},${HudArrayTimer[5,3]},]}
    HudSpell3=3,530,260,255,255,255,${If[${String[${HudArrayTimer[2,3]}].NotEqual["NULL"]},${HudArrayTimer[2,3]},]}
   HudTarget3=3,630,260,255,255,050,${If[${String[${HudArrayTimer[3,3]}].NotEqual["NULL"]},${HudArrayTimer[3,3]},]}

    HudTimer4=3,480,270,050,255,255,${If[${String[${HudArrayTimer[5,4]}].NotEqual["NULL"]},${HudArrayTimer[5,4]},]}
    HudSpell4=3,530,270,255,255,255,${If[${String[${HudArrayTimer[2,4]}].NotEqual["NULL"]},${HudArrayTimer[3,4]},]}
   HudTarget4=3,630,270,255,255,050,${If[${String[${HudArrayTimer[3,4]}].NotEqual["NULL"]},${HudArrayTimer[3,4]},]}

    HudTimer5=3,480,280,050,255,255,${If[${String[${HudArrayTimer[5,5]}].NotEqual["NULL"]},${HudArrayTimer[5,5]},]}
    HudSpell5=3,530,280,255,255,255,${If[${String[${HudArrayTimer[2,5]}].NotEqual["NULL"]},${HudArrayTimer[3,5]},]}
   HudTarget5=3,630,280,255,255,050,${If[${String[${HudArrayTimer[3,5]}].NotEqual["NULL"]},${HudArrayTimer[3,5]},]}

theoneandonly
orc pawn
orc pawn
Posts: 26
Joined: Sun Apr 11, 2004 6:39 pm

Post by theoneandonly » Tue Sep 21, 2004 5:26 pm

dunno if its me, but its still broke

Timplo
orc pawn
orc pawn
Posts: 10
Joined: Wed Sep 22, 2004 7:00 pm

Update Code

Post by Timplo » Wed Sep 22, 2004 7:02 pm

Here is above code did some changes to it to get it to work.
I will be adding to this. Like adding in option to autotarget mob on say mez time remaing - xsecs e.

Code: Select all


| 
| HuDTimer.mac 
| 
| This macro will react to spells cast on your target. 
| It displays the time remaining on the spell cast,the 
| spell cast, and the mob cast upon. 
| 
| Currently it will display 5 debuffs at once. 
| It will refresh any identical buff recast on the same mob 
| It fills in timer slots from top to bottom as available 
| Displays timer list full when max timers are running 
| 
| TODO: 
| 
| - dynamically create entries in the MQ2Hud.ini file to allow for more timers 
| - read #Event information from an .ini file 
| - revisit formatting spell duration (ticks) into time (hh:mm:ss) 
| - write as HudTimer.inc and call from Personal.inc for genbot. 
| 
| by 
| Seagreen 
| 

#turbo 40 

#Event Malos "#*#very uncomfortable#*#" 
#Event Turgurs "#*#yawns.#*#" 
#Event Root "#*#to the ground#*#" 
#Event Tash "#*#glances nervously about.#*#" 
#Event Bliss "#*#begin to drool.#*#" 
#Event Forlorn "#*#slows down.#*#" 
#Event Apathy "#*# stares off into the distance.#*#" 
#Event Sleep "#*#falls asleep.#*#" 
#Event Rapture "#*#in raptured bliss.#*#" 

sub Main 
   /declare counter int outer 
   /declare DebuffSpell string outer 
   /declare HudArrayTimer[5,5] string outer NULL 
      | [1,x] 1. Ending time of debuff 
      | [2.x] 2. Name of spell cast on npc 
      | [3.x] 3. Long name of npc 
      | [4.x] 4. ID of npc 
      | [5.x] 5. Duration (formatted) 

   /echo HuD DEBUFF Timer is now ACTIVE. 

   :mainloop 

   /doevents 
   /call CheckTimer 
   /delay 1 

   /goto :mainloop 
/return 

Sub Event_Tash 
   /varset DebuffSpell Howl of Tashan 
   /echo ${DebuffSpell} 
   /call SetupTimer 
/return 

Sub Event_Rapture 
   /varset DebuffSpell Rapture 
   /echo ${DebuffSpell} 
   /call SetupTimer 
/return 

Sub Event_Sleep 
   /varset DebuffSpell Sleep 
   /echo ${DebuffSpell} 
   /call SetupTimer 
/return 

Sub Event_Apathy 
   /varset DebuffSpell Apathy 
   /echo ${DebuffSpell} 
   /call SetupTimer 
/return 

Sub Event_Forlorn 
   /varset DebuffSpell Forlorn Deeds 
   /echo ${DebuffSpell} 
   /call SetupTimer 
/return 

Sub Event_Bliss 
   /varset DebuffSpell Bliss 
   /echo ${DebuffSpell} 
   /call SetupTimer 
/return 

Sub Event_Malos 
   /varset DebuffSpell Malos 
   /echo ${DebuffSpell} 
   /call SetupTimer 
/return 

Sub Event_Turgurs 
   /varset DebuffSpell Turgur's Insects 
   /echo ${DebuffSpell} 
   /call SetupTimer 
/return 

Sub Event_Root 
   /varset DebuffSpell Greater Immobilize 
   /call SetupTimer 
/return 

Sub SetupTimer 
   /declare duration int local 

| 
| IF SAME DEBUFF IS BEING RECAST ON EXISTING NPC IN TIMER ARRAY, REFRESH 
| 
   /for counter 1 to 5 
   /if (${Spawn[${HudArrayTimer[4,${counter}]}].ID}==${Target.ID} && ${String[${HudArrayTimer[2,${counter}]}].Equal[${DebuffSpell}]}) { 
      /varset HudArrayTimer[1,${counter}] ${Math.Calc[${Time.SecondsSinceMidnight}+(${Spell[${DebuffSpell}].Duration}*6)]} 
       /varset HudArrayTimer[2,${counter}] ${DebuffSpell} 
      /varset HudArrayTimer[3,${counter}] ${Target} 
      /varset HudArrayTimer[4,${counter}] ${Target.ID} 
     
     /return 
   } 
   /next counter 

| 
| SETUP NEW DEBUFF OF NPC IN OPEN SLOT 
| 
   /varset counter 1 
   :counterloop 
   /if (!${Spawn[${HudArrayTimer[4,${counter}]}].ID} && !(${Math.Calc[${HudArrayTimer[1,${counter}]}-${Time.SecondsSinceMidnight}].Int}>0)) { 
      /varset HudArrayTimer[1,${counter}] ${Math.Calc[${Time.SecondsSinceMidnight}+(${Spell[${DebuffSpell}].Duration}*6)]} 
       /varset HudArrayTimer[2,${counter}] ${DebuffSpell} 
      /varset HudArrayTimer[3,${counter}] ${Target} 
      /varset HudArrayTimer[4,${counter}] ${Target.ID} 
   } else { 
      /if (${counter}>4) { 
         /echo Debuff timer slots are full 
         /return 
      } 
      
      /varcalc counter ${counter}+1 
      /goto :counterloop 
      } 
/return 


Sub CheckTimer 
   /declare duration int local 
   /declare myhour string local 
   /declare myminute string local 
   /declare mysecond string local 

  /for counter 1 to 5 
  
   /if (!${Spawn[${HudArrayTimer[4,${counter}]}].State.Equal[DEAD]} && ${Math.Calc[${HudArrayTimer[1,${counter}]}-${Time.SecondsSinceMidnight}].Int}>0) { 
| 
| FORMAT DURATION TO 00:00:00 
|    
      /varset duration ${Math.Calc[${HudArrayTimer[1,${counter}]}-${Time.SecondsSinceMidnight}].Int} 
      
      /if (${duration}>3600) { 
         /varset myhour ${Math.Calc[${duration}/3600].Int} 
         /varset duration ${Math.Calc[((${duration}/3600)-${myhour})*3600]} 
      } else { 
         /varset myhour 
      } 
      
      /if (${duration}>60) { 
 
         /varset myminute ${Math.Calc[${duration}/60].Int} 
         /varset duration ${Math.Calc[${Math.Calc[${Int[${duration}/60]}]} - ${Math.Calc[${myminute}]}*60]}
         
        
         /if (${myhour} && ${myminute}<0) /varset myminute 0${myminute} 
      } else { 
         /varset myminute 
      } 
      
      /if (${duration}>=0) { 
              
               /varset mysecond ${Int[${duration}/6]}
               /if (${myminute} && ${mysecond}<0) /varset mysecond 0${mysecond} 
            } else { 
               /varset mysecond 0 
      }
 
| 
| DISPLAY HH:MM:SS IF NEEDED 
| 

      /if (${myhour.NotEqual[NULL]} && ${Int[${myhour}]} !=0) {
         /varset HudArrayTimer[5,${counter}] ${myhour}:${myminute}m:${mysecond}s 
      } else /if (${myminute.NotEqual[NULL]}&& ${Int[${myminute}]} !=0) { 
         /varset HudArrayTimer[5,${counter}] ${myminute}m:${mysecond}s 
      } else /if (${mysecond.NotEqual[NULL]}) { 
         /varset HudArrayTimer[5,${counter}] ${mysecond}s 
      } 
   } else { 
      /varset HudArrayTimer[1,${counter}] 
      /varset HudArrayTimer[2,${counter}] 
      /varset HudArrayTimer[3,${counter}] 
      /varset HudArrayTimer[4,${counter}] 
      /varset HudArrayTimer[5,${counter}] 
      } 
        
   /next counter 
/return