Page 1 of 2

Loot Nearest Corpse

Posted: Mon Jul 26, 2004 10:12 pm
by EQBot_man
So I found no reliable corpse looting subroutine. So I wrote my own for two different circumstances. I've tested these a lot so they work pretty well.

This first one will take a string input and will loot the entire corpse and search for that item. I used this while camping for the shrink wand in the deep. This subroutine has been tweaked and played with over and over again for reliable looting in real EQ circumstances(a mob aggroing you while looting, it fucking up and you never standing up, and possibly dying from that, etc).

This subroutine will target the nearest corpse. Then if it the corpse less than 120feet away it will move to it reliably and loot it. IF its more than 120 it will return(so you don't run off all crazy and die). Also if an item is worth 5pp or more, or has a tribute value of 500 or more it will keep it. If you don't finish looting the corpse within 7seconds of the subroutine being called you will stand up just in case you are stuck. In my main programs I call the subroutine twice in a row. I've found while camping for things somethign would aggro and my macro wouldn't finish looting the corpse. Just call it twice in a row and you should be fine, but like anything try it out first to see if you need to change any of the code. You can call another routine to camp you out after you find what you want or whatever. Add the /call function where you see: |/call FindWand, left over from when I found my wand:

/call LootMob "Wand of"
/call LootMob "Wand of"


8.10.2004 - I realized I had posted my includes verbatim. I use /mqgoto instead of the regular /goto. I changed it should work fine now

Code: Select all

sub LootMob(Loot)
| Note: the number 4.3 in the /varset MoveDelay was empirically
|	set for IRS5 ( Speed = 150 )
/declare MoveDelay int local
/declare LootSlot int local 1

/keypress ESC
/keypress ESC
/keypress ESC
/keypress ESC
/timed 150 /stand
/timed 155	 /notify LootWnd DoneButton leftmouseup
:Top

    /target npc corpse
    /delay 2
    	/if (${Target.Distance}<15) {
        		/face fast
	} else /if (${Target.Distance}>=15 && ${Target.Distance}<120) {
        	/face fast
        	/keypress forward hold
		/varset MoveDelay ${Math.Calc[(${Target.Distance})/4.3]}
		    	/keypress forward hold
		    	/delay ${MoveDelay}
		/keypress forward
		/goto :Top
    	} else {
    		/echo Corpse is too far away
    		/keypress ESC
    		/return
    	}

	/echo Looking for "${Loot}"
    :LootWnd
    /loot

    /if (!${Window[LootWnd].Open}) /goto :LootWnd
   :lootloop
	/if (${Me.State.Equal["STAND"]}) /goto :doneloot
   /if (${Corpse.Items}==0) {
      	/goto :doneloot
   }

   /if (${LootSlot}>=32) /goto :doneloot

   :Loot
   /itemnotify Loot${LootSlot} leftmouseup
   /delay 1s

   	/if (${Window[ConfirmationDialogBox].Open}) {
   		/notify ConfirmationDialogBox Yes_Button leftmouseup
   		/delay 1s
   	}

   /if (${String[${Cursor.Name}].Find[${Loot}]}) {
   	    /echo YOU WIN: ${Cursor.Name}
	    /autoinv
	    /delay 2
	    |/call FindWand

   } else {
	/if (${Cursor.Value}>5000 || ${Cursor.Tribute}>500) {
		/echo ${Cursor.Name} is worth more than 5pp or tribute is greater than 500
   	  	/autoinv
   	  	/delay 5
   	} else {
		/echo Destroying ${Cursor}
		/destroy
		/delay 5
   	}
   }

   /varcalc LootSlot ${LootSlot}+1
   /goto :lootloop
   :doneloot
   /notify LootWnd DoneButton leftmouseup
   /varset LootSlot 0
/return
This next one Will just loot everything in a 120 unit range:

Code: Select all

sub Lootnpc
| Note: the number 4.3 in the /varset MoveDelay was empirically
|	set for IRS5 ( Speed = 150 )
/declare MoveDelay int local
/declare LootSlot int local 1

/keypress ESC
/keypress ESC
/keypress ESC
/keypress ESC
/timed 70 /stand
/timed 75 /notify LootWnd DoneButton leftmouseup

:Top

    /target corpse
    /delay 2
    	/if (${Target.Distance}<15) {
	        		/face fast
		} else /if (${Target.Distance}>=15 && ${Target.Distance}<120) {
	        	/face fast
	        	/keypress forward hold
			/varset MoveDelay ${Math.Calc[(${Target.Distance})/4.3]}
			    	/keypress forward hold
			    	/delay ${MoveDelay}
			/keypress forward
			/goto :Top
	    	} else {
	    		/echo Corpse is too far away
	    		/keypress ESC
	    		/return
    	}

    :LootWnd
    /loot
    /delay 1
    /if (!${Window[LootWnd].Open}) /goto :LootWnd
   :lootloop

	/if (${Me.State.Equal["STAND"]}) /goto :doneloot

   /if (${Corpse.Items}==0) {
      	/goto :doneloot
   }

   /if (${LootSlot}>=32) /goto :doneloot

   :Loot
   /itemnotify Loot${LootSlot} leftmouseup
   /delay 1s

   	/if (${Window[ConfirmationDialogBox].Open}) {
   		/notify ConfirmationDialogBox Yes_Button leftmouseup
   		/delay 1s
   	}

	    /autoinventory
	    /delay 2

   /varcalc LootSlot ${LootSlot}+1
   /goto :lootloop
   :doneloot
   /notify LootWnd DoneButton leftmouseup
   /varset LootSlot 0

Posted: Mon Jul 26, 2004 10:18 pm
by Drumstix42
Can simply add in:

Code: Select all

/if (${Target.Name}==(${Me.Name}'s corpse)) /endmacro
or something of that nature.

Posted: Tue Aug 03, 2004 6:02 am
by fantum409
OMG pure evil. You fall and die near bind point while SOK... you wake up perma-naked. heh.

Drumstix42 has a good idea there

Code: Select all

/if (${String[${Target.Name}].Equal[${Me.Name}'s corpse]}) /endmacro

Check before looting

Posted: Sat Aug 07, 2004 10:15 pm
by Chill
I suggest checking the item to see if its something you want to loot BEFORE looting. Unless you are killing a lot of mobs in exactly the same spot or NEED to keep your camp tidey for some other reason, it would be faster and avoids destroying items.

Posted: Sat Aug 07, 2004 11:02 pm
by EQBot_man
I changed my final post to reflect my final subroutines after lots of testing. Feel free to look at them and use them as you wand

Re: Check before looting

Posted: Sat Aug 07, 2004 11:13 pm
by loadingpleasewait
Chill wrote:I suggest checking the item to see if its something you want to loot BEFORE looting. Unless you are killing a lot of mobs in exactly the same spot or NEED to keep your camp tidey for some other reason, it would be faster and avoids destroying items.
If you left a corpse there, would it not just keep trying to loot the same corpse over and over again? I think it would..

Posted: Sun Aug 08, 2004 12:18 am
by Drumstix42
you'd have to get into ID Checking I'm guessing if you wanted to go that route.

Posted: Sun Aug 08, 2004 10:22 am
by blueninja
Don't use Target.Name, use Target.CleanName. Or change what it compares to.

application?

Posted: Mon Aug 09, 2004 2:07 am
by EQBot_man
I wrote these loot corpse sub routines to help me farm Spider silks, Bone Chips, and the Wand of Imperciptibility. The lootnpc(Loot) subroutine is for doing just that...looking for an exact item that you want and estroying the rest. If you are doing automated unattended farming of one item, this is what you want. Not sure of the application you are using it for but it works to loot a mob of a specific farming item

Posted: Fri Sep 10, 2004 8:27 am
by Shenlon
EQBot_man, I have used your loot macro in one of my own macros and for the vast majority of the time, it works perfectly. However, every now and then I will get stuck with no target and in the /loot loop. So all I get is tons and tons of spam saying that I must first target a corpse to loot. After running this macro for a week or so on and off I believe I have only gotten in 3 or 4 times, so it has been difficult to pin down what happens to throw your code off like that. Anyways, I just added a small line right above /loot.

Code: Select all

/if (${Target}==NULL) /return
Don't know if you have had that problem or not, just thought I might point out what I did to fix it in case anyone else had the problem.


***EDIT***
Nevermind, ran into an error with this method, hope no one used it in a macro yet.

Posted: Mon Sep 13, 2004 10:12 am
by wolfbaby
if you make a ini file to let the mq2 know what to loot ,that will be better

Posted: Sun Oct 24, 2004 12:17 pm
by twisted82
Getting error,

Code: Select all

/Varset failed, variable 'MoveDelay' not found
(Lootnpc):  /varset MoveDelay ${Math.Calc[(${Target.Distance})/4.3]} 
Im still learning commands, but the /variable is stated.


First thing, yes - I have /declare MoveDelay int local ..

Any suggestions as to WTF is going on ? ..


-Edit-
I've solved my own problem, I had moved the /declare MoveDelay int local out of the sub, without changing the local to outer. Like I said, I'm new to this ..

Now, how to figure out the run speed of jboots: 4.3=IRS5 sigh ..


-Twisted82-
Im just a noob, trying to get a nut.

Posted: Sun Oct 24, 2004 3:38 pm
by Dark_Lord_X
Jboots = 135

Posted: Mon Nov 15, 2004 10:09 am
by DeeGee
Shenlon wrote:

Code: Select all

/if (${Target}==NULL) /return
Don't know if you have had that problem or not, just thought I might point out what I did to fix it in case anyone else had the problem.


***EDIT***
Nevermind, ran into an error with this method, hope no one used it in a macro yet.
I had the same issues as you. What I did was add this to all loops.

Code: Select all

/if (!${Target.ID}) /goto :doneloot

First Item

Posted: Sun Jun 17, 2007 8:03 pm
by mrwhionyx
I'm having issues with the 2nd macro post of looting all npc corpse's in the area around me. It only seems loot the first item then ends the macro. Now I know I'm new to this, But I have looked it over and I can't see the code that would be stopping this.