Buff Duration check and rebuff routines to #include

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

User avatar
SingleServing
a hill giant
a hill giant
Posts: 195
Joined: Tue Dec 17, 2002 11:00 pm

Buff Duration check and rebuff routines to #include

Post by SingleServing » Sun Dec 22, 2002 6:04 am

I have not been able to test this yet can someone look a look at the code and/or test this out and let me know how you like it. Thanks =)

Code: Select all

|*******************************************************************|
| The goal of this is to check a characters buffs and alert  
| that character when the buffs duration is ==3 m or less
| then store the buff name to an array. For possible recast...
|*******************************************************************|

#include spellbook.mac
#include spellcast.mac

Sub CheckBuffs

/varset v25 0


/for v25 0 to 20 

	/varset a(30,$v25) $char(buff,$v25)
	/if a(30,$v25)==NULL {
		/varcalc v26 $v25-1	
		/varset v25 19
	}

/next v25

/for v25 0 to $v26

	/echo a(30,$v25) has $char(buff,$v25,duration) ticks remaining.

/next v25

/varset v27 0

|This loop makes a list of buffs that are below 30 ticks
| and stores them in a(31,v27)

/for v25 0 to $v26

	/if n $char(buff,a(30,$v25),duration)<=30 {
		/varadd v27 1
		/if n v27>8 {
			/echo ERROR TOO MANY BUFFS WEARING OFF
			/echo Quitting...
			/return
		}
		/varset a(31,$v27) $char(buff,$v25)
	}

/next v25

/return

|*******************************************************************|

|
| WARNING: You must CheckBuffs before running this subroutine
| 

|	In theory this will forget your spells beggining at 1
|	up to 8 spells memorize them cast them and put your old
|	spells back where they were before you forgot them

Sub RefreshBuffs

/varcalc v28 $v27+1

/varset v29 0

/for 1 to $v28

	/varset a(32,$v29) $char(buff,$v28)
	/varadd v29 1

/next

/for v25 1 to $v28

	/call ForgetSpellByNumber $v25

/next v25

/varset v29 0

/for v25 1 to $v28
	
	/call MemorizeSpell a(31,$v29) $v25

	/varadd v29 1

/next

/target myself

/varset v29 0

/for v25 1 to $v28
	
	/call Cast a(31,$v29) $v25

	/varadd v29 1

/next


/for v25 1 to $v28

	/call ForgetSpellByNumber $v25

/next v25

/varset v29 0

/for v25 1 to $v28
	
	/call MemorizeSpell a(32,$v29) $v25

	/varadd v29 1

/next

/return