The Super-Dereferencer and Extended Buff Refresh Timer

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

Tuna
a lesser mummy
a lesser mummy
Posts: 68
Joined: Mon Jul 21, 2003 4:10 pm

The Super-Dereferencer and Extended Buff Refresh Timer

Post by Tuna » Wed Feb 04, 2004 9:42 pm

Code: Select all

| ------------------------------------------------------------------------
| Super Dereferencer Test
| By Tuna
|
| All of my timer variable names are prefixed with "t_"
| Also, all my spell name defines are prefixed with "sn_"
| This script shows you how useful dereferencing variables
| can be if you keep your defines and your variable names clean.
| ------------------------------------------------------------------------


#turbo
| --------------------------------------------------------------------
| My toon has spell casting reinforcement 3 (30% extension) and
| an item which I believe gives another 15%.  So I am guessimating
| that the time to extend buffs is 145%.
| Change this constant as you see fit.
| --------------------------------------------------------------------
#define CHAR_BUFF_EXTENSION	1.45

sub Main
	/declare t_Haste timer
	/declare t_Regen timer
	/declare t_Crack timer
	/declare sn_Haste	global
	/declare sn_Regen	global
	/declare sn_Crack	global

	/varset sn_Haste	"Celerity"
	/varset sn_Regen	"Regrowth"
	/varset sn_Crack	"Spiritual Dominion"

	| Expire the timers (pretend like buffs are needed)
	/varset t_Haste 0
	/varset t_Regen 0
	/varset t_Crack 0

	/call RecastBuff "Haste"
	/delay 2s
	/call RecastBuff "Regen"
	/delay 2s
	/call RecastBuff "Crack"
	/delay 2s

	/echo Back in Main()... Buff timers are @t_Haste, @t_Regen, @t_Crack
	/echo Delaying 2 seconds...
	/delay 2s
	/echo Done with delay.  Timers are now @t_Haste, @t_Regen, @t_Crack
	/call RecastBuff "Haste"
	/call RecastBuff "Regen"
	/call RecastBuff "Crack"
/return


| -------------------------------------------------------------------
| RecastBuff
| PARAMETERS:
|	Param0:  Should be some name like "Haste", "Crack" or "Regen"
|
|	If you call this function with "Haste" as a parameter,
| It will assume @sn_Haste and @t_Haste exist.  It expects
| @sn_Haste to name a valid spell your character can cast,
| and it expects @t_Haste to be a valid, global timer.
| -------------------------------------------------------------------
sub RecastBuff
	/declare c local
	/declare timerVal	local
	/declare spellName	local

	/varset spellName "@sn_@Param0"
	/varset timerVal @t_@Param0

	/echo Recasting buff for @Param0 ... currently @spellName
	/echo Timer variable ( t_@Param0 ) has val @timerVal

	/if n @timerVal<=0 {
		/echo /target PC Someplayername
		/echo /cast "@spellName"

		/varcalc c $spell("@spellName",duration)*CHAR_BUFF_EXTENSION*10
		/varset t_@Param0 $int(@c)

		| Now recalc just for the /echo
		/varcalc c $spell("@spellName",duration)*CHAR_BUFF_EXTENSION
		/echo Waiting $int(@c) seconds before putting @spellName on $target(name) again
	} else {
		/echo @spellName doesn't need refreshed yet
	}

/return

| end