avatar.mac (Lazy melee Avatar proc switcher)

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

Moderator: MacroQuest Developers

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

avatar.mac (Lazy melee Avatar proc switcher)

Post by kagonis » Thu Jul 03, 2003 12:53 am

This macro isn't tested, and the syntax isn't very pretty since I just kinda scrambled it all together pretty late.
Please feel free to report any bugs you find, and remember, don't move the mouse while this macro is running ;)

Oh, it uses $char(buff,"buff name") to check for the buff, I'm not sure if it has been fixed in CVS, if not then please refer to these threads on how to fix it yourself:
http://macroquest2.com/phpBB2/viewtopic ... 7157#17157 (A patch file to patch your MQ.h)
http://macroquest2.com/phpBB2/viewtopic ... 6695#16695 (The actual post where Amadeus explains how to fix it)

Code: Select all

#define ITEMPACK v0
#define ITEMSLOT v1

Sub Main
	/if n $char(buff,"Ferine Avatar")>0 /goto :End
	/if n $char(buff,"Avatar")>0 /goto :End
	/if n $target(id)>0 /varset l0 $target(id)
	/cleanup
	/if n $l0>0 /target id $l0
	/call ItemFinder "Primal Velium Spear"
	/if n $return==0 /endmacro

	/click right inv ITEMPACK
	:WaitOpen1
		/if "$pack($ITEMPACK),open)"=="FALSE" /goto :WaitOpen1
	/sendkey down ctrl
	/click left pack $ITEMPACK $ITEMSLOT
	/sendkey up ctrl
	/press ctrl
	:WaitCursor1
		/if "$cursor()"!="TRUE" /goto :WaitCursor1
	/varset l2 "$cursor(name)"
	/if "$equip(primary)"!="NULL" /varset l1 "$equip(primary,name)"
	/click left primary
	:WaitEquip1
		/if "$cursor(name)"=="$l2" /goto :WaitEquip1
	/click left auto
	:WaitAuto1
		/if "$cursor()"=="TRUE" /goto :WaitAuto1
	/if n $target(id)>0 /varset l0 $target(id)
	/cleanup
	/press i
	/if n $l0>0 /target id $l0
	:WaitAvatar
		/if n $char(buff,"Ferine Avatar")>0 /goto :SwitchBack
		/if n $char(buff,"Avatar")>0 /goto :SwitchBack
	/goto :WaitAvatar

	:SwitchBack
		/if n $target(id)>0 /varset l0 $target(id)
		/cleanup
		/if n $l0>0 /target id $l0
		/call ItemFinder "$l1"
		/if n $return==0 /endmacro

		/click right inv ITEMPACK
		:WaitOpen2
			/if "$pack($ITEMPACK),open)"=="FALSE" /goto :WaitOpen2
		/sendkey down ctrl
		/click left pack $ITEMPACK $ITEMSLOT
		/sendkey up ctrl
		/press ctrl
		:WaitCursor2
			/if "$cursor()"!="TRUE" /goto :WaitCursor2
		/varset l2 "$cursor(name)"
		/click left primary
		:WaitEquip2
			/if "$cursor(name)"=="$l2" /goto :WaitEquip2
		/click left auto
		:WaitAuto2
			/if "$cursor()"=="TRUE" /goto :WaitAuto2
		/cleanup
		/press i
	:End
/return

Sub ItemFinder
	/if n $strlen("$p0")==0 {
		/echo Syntax: /call ItemFinder "Item To Find"
		/endmacro
	}
	/for ITEMPACK 0 to 7
		/if "$pack($int($ITEMPACK))"=="TRUE" {
			/for ITEMSLOT 0 to $calc($pack($ITEMPACK,slots)-1)
				/if "$item($ITEMPACK,$ITEMSLOT,name)"=="$p0" /return
			/next ITEMSLOT
		} 
	/next ITEMPACK
/return 0