Intelligent AutoLooting Code

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

Moderator: MacroQuest Developers

GD
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jun 29, 2002 11:57 pm

Intelligent AutoLooting Code

Post by GD » Mon Sep 23, 2002 3:17 am

This is some looting code I put together to first Con a corpse to see if it has loot. If it has 0 minutes, it bypasses the looting portion and ends the subroutine.

If the corpse has loot, it'll take you to it and begin looting, using the "You have looted.." messages to tell it whether it should continue looting. If it doesn't get a loot message, it stops looting and ends the subroutine.

$v90 is the saved target ID of the mob you just killed. You will want to make sure you save the ID of the mob you are killing, at a point somewhere in your attack code, so that it targets the correct corpse when it's dead.

You may need to increase/decrease the delays depending on your lag conditions.

Code: Select all

#Event CorpseTime "This corpse will decay in 0"
#Event Looted "--You have looted a "

Sub AutoLoot
	/press esc
	/target id $v90
	/con
	/delay 5
	/doevents
	/if n $v4==1 /goto :Continue
	/if n $target(distance)<15 /goto :LootCorpse
	/sendkey down up

	:FaceCorpse
		/delay 0
		/face
		/if n $target(distance)>14 /goto :FaceCorpse

	:LootCorpse
		/sendkey up up
		/loot
		/delay 10
		/varset v3 0

	:Looting
		/delay 0
		/varset v5 $v3
		/click right corpse $v3
		/delay 5
		/doevents
		/if n $v3>$v5 /goto :Looting
		/press esc

	:Continue
		/varset v4 0

/return

Sub Event_CorpseTime
	/varset v4 1
/return

Sub Event_Looted
	/varadd v3 1
/return
Opinions are like assholes, everyone has one, but most of them stink.