Page 1 of 1

AFK Looting Macro

Posted: Fri Jul 23, 2004 2:44 pm
by screwju
Wasn't able to find anything exactly like this so a Friend and I came up with this.

Code: Select all

#Event zone "#*#You have entered #*#"

Sub main
   /declare MyXLOCA int outer 0
   /declare MyYLOCA int outer 0
   /declare BreakLoop int outer 0
   /declare AnchorX int outer ${Me.X}
   /declare AnchorY int outer ${Me.Y}
   /declare LootSlot int outer 0 
   /declare LootCheck int outer 0 
   /declare LootTotal int outer 0 
   /declare locv1 int outer 0
   /declare xDistance int outer 0  
:Loopa
/call Loot
/call CheckAnchor
/delay 1m
/goto :Loopa
/endmacro


Sub Loot 


   :LtLoop 
   /varcalc locv1 ${locv1}+1 
   /target corpse radius 400 
   /if (!${Target.ID} || ${Target.Type.NotEqual[Corpse]}) /return 
   /varset xDistance 5 
   /call GotoBody ${Target.ID} 
   /if (${Target.ID}) /face nolook fast 
   /loot 
   /delay 40 ${Window[LootWnd].Open} 
   /if (!${Corpse.Items}) { 
      /goto :ExitSWLt 
   } 
   /varset LootTotal ${Corpse.Items} 
   /for LootSlot 1 to ${LootTotal} 
      /itemnotify loot${LootSlot} rightmouseup 
      /delay 10 ${Cursor.ID} 
      /notify InventoryWindow IW_CharacterView rightmouseup 
      /delay 10 
      :NextSWLt 
   /next LootSlot 
   :ExitSWLt 
   /cleanup 
   /delay 10 
   /if (${locv1}<4) /goto :LtLoop 
/return

Sub GotoBody(BodyID)
   /varset BreakLoop 0 
   /if (${Me.Mount.ID}) { 
      /dismount 
      /delay 10 
   } 
   /if (${Me.Sitting}) /stand 
   /if (${Target.ID}!=${BodyID}) { 
      /keypress clear_target 
      /delay 3 
      /target id ${BodyID} 
      /delay 3 
   } 
    
   :KeepGoingBody 
   /doevents 
   /delay 0 
   /if (${BreakLoop}==1) /return 
   /if (${Target.Distance}>=10) { 
      /face nolook fast 
      /keypress forward hold 
   } 
   /if (${Target.Distance}<10) {
      /varset BreakLoop 1 
      /keypress forward 
      /return 
   } 
   /call CheckObstacle 
   /if (${BreakLoop}!=1) /goto :KeepGoingBody 
/return

|# Checks to see if we may have bumped into something that is stopping us 
sub CheckObstacle
   |# Record our current position, wait a moment and then check if its the same 
   /varset MyXLOCA ${Me.X} 
   /varset MyYLOCA ${Me.Y} 
   /delay 2 
   /if (${MyXLOCA}==${Me.X} && ${MyYLOCA}==${Me.Y}) /call Obstacle 
/return 

|# Uses strafe and randomness to try and get around things 
sub Obstacle 
   /keypress forward 
   /keypress back hold 
   /delay 5 
   /keypress back 
   /if (${Math.Rand[2]}) { 
      /keypress strafe_right hold 
      /delay 3 
      /keypress strafe_right 
   } else { 
      /keypress strafe_left hold 
      /delay 3 
      /keypress strafe_left 
   } 
   /keypress forward hold 
/return

Sub CheckAnchor    
  /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) /call MoveToAnchor   
/return

Sub MoveToAnchor 
    /declare iCount int local 
    /varset iCount 0 

    /echo Moving to Anchor at Loc: ${AnchorY}, ${AnchorX}. 

:AnchorMoveLoop  
    /delay 1 
    /doevents 
    /face nolook loc ${AnchorY},${AnchorX} 
    
    /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) { 
       /keypress forward hold 
   } else { 
       /keypress forward
       /face away loc ${AnchorY},${AnchorX}
        /return 
    } 

    /if (${iCount}>2) { 
        /call Detectobst 
        /face nolook loc ${AnchorY},${AnchorX} 
        /varset iCount 0 
    } 
    
    /varcalc iCount ${iCount}+1 
    /goto :AnchorMoveLoop 
/return

Sub Detectobst
/return 
 
/endmacro

Sub Event_zone
  /echo ZONE! Ending macro!
  /endmacro
/return

Any suggestions / revisions would be greatly appreciated.

Posted: Sun Aug 08, 2004 10:39 pm
by Bardmad
nice macro, but it cant loot no drop item, is there a way to do so? can it specify to loot only a certain thing, cos it's great to use it for camping cleric's epic item (shards from Skyfire). Duo with some other hnting macro.

Posted: Sun Aug 08, 2004 10:56 pm
by VorticoNT
/lootnodrop always

That should turn off the confirmation window for no drop

Posted: Sun Aug 08, 2004 11:51 pm
by Goofmester1
Might want to add a check to make sure it isn't a PC corpse.

Posted: Tue Sep 14, 2004 11:13 am
by morevit
VorticoNT wrote:/lootnodrop always

That should turn off the confirmation window for no drop
No, the command is bassackwards. You want

/lootnodrop never

to never put up the confirmation window.

Posted: Sat Jan 29, 2005 2:01 am
by FrOsTy
This was working until the last release/patch. Now, it simply moves to the body and attempts to loot to no avail. It tries 3 or 4 times and then gives up and moves back to the anchor. Yes, I've already recompiled the 1/28/2005 release of MQ2 and all the plugins I use (which seems to grow with each release, hehe).

I am new to this MQ stuff, so, has anything changed to make this broken?!

Posted: Sat Jan 29, 2005 5:19 am
by aChallenged1
I haven't tried it this morning, since the new 1-28 zip release, but last night I could not use my custom bind to loot corpses. I'll try with the new release.

Posted: Sun Jan 30, 2005 5:42 am
by hairpin
Clearly a raiding macro.

Posted: Sat May 07, 2005 6:31 pm
by Soul Hunter
What would I need to add in order for it to only loot a certain type of item or item's with a certain name in common like 'Cloth" or 'Fine Steel".

any update

Posted: Mon Aug 22, 2005 10:16 am
by unknownerrors
macro is currently not working. is there any update comming ??

Posted: Mon Aug 22, 2005 11:52 am
by Slice
"Macro is not working" covers a wide spectrum. What happens when you run the macro? Is there an error message?

errors

Posted: Thu Aug 25, 2005 1:28 pm
by unknownerrors
when ran these lines return errors. the macro still runs, but does not loot anything more then mone. all items are left on the corpse until you are forced to close the loot window because the corpse is rotting.

Code: Select all

 /declare LootSlot int outer 0 

Code: Select all

 /declare LootTotal int outer 0 

these two items are used in the loot sub, and i see no reason why they shouldn't be working

Code: Select all

   /varset LootTotal ${Corpse.Items}
   /for LootSlot 1 to ${LootTotal}
but then again i'm not really very good with this stuff yet.

Posted: Thu Aug 25, 2005 10:09 pm
by JJ
Try introducing some delays. If you look in the snippets forum I made a loot include file that shows good delays.