Looting.

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

Kore
orc pawn
orc pawn
Posts: 13
Joined: Fri Jun 04, 2004 4:38 am

Looting.

Post by Kore » Sat Jun 12, 2004 7:25 am

I've been attempting to create a simple looting sub for my autoxp bot team i have going, and I just cant get the looting codes correct - nothing in search nor in the areas i've looked satisify what i'm trying to do.

Basically, what i want to do is loot everything that drop on the mobs that i'm fighting without having to code in exactly what it is i want to loot (the mobs i'm fighting keep dropping different spells and such that i didnt even know they dropped!).

They drop no more than 2 loot pieces at a time.

Any and all help with this sub would be greatly appreciated.

Thank you!

Falco72
a hill giant
a hill giant
Posts: 215
Joined: Fri Sep 26, 2003 3:24 am

Post by Falco72 » Sat Jun 12, 2004 10:37 am

Code: Select all

Sub Loot
   /declare LootSlot int local 0
   /declare LootCheck int local 0
   /declare LootTotal int local 0
   /declare locv1 int local 0

   :LtLoop
   /varcalc locv1 ${locv1}+1
   /target corpse radius 150
   /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} leftmouseup
      /delay 10 ${Cursor.ID}
      /autoinventory
      /delay 10
      :NextSWLt
   /next LootSlot
   :ExitSWLt
   /cleanup
   /delay 10
   /if (${locv1}<4) /goto :LtLoop
/return

Falco72
a hill giant
a hill giant
Posts: 215
Joined: Fri Sep 26, 2003 3:24 am

Post by Falco72 » Sat Jun 12, 2004 10:39 am

Forgot to add I got that code from Macro depot forum.

Kore
orc pawn
orc pawn
Posts: 13
Joined: Fri Jun 04, 2004 4:38 am

Post by Kore » Sun Jun 13, 2004 7:25 am

Thanks, but it's incomplete - missing GotoBody. But its somthing to work with.

Falco72
a hill giant
a hill giant
Posts: 215
Joined: Fri Sep 26, 2003 3:24 am

Post by Falco72 » Sun Jun 13, 2004 9:24 am

Code: Select all

Sub GotoBody(BodyID)
   /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}>=${xDistance}) {
      /face nolook fast
      /keypress forward hold
   }
   /if (${Target.Distance}<${xDistance}) {
      /keypress forward
      /return
   }
   /call CheckObstacle
   /if (${BreakLoop}!=1) /goto :KeepGoingBody
/return

Code: Select all

|# 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 MyXLOC ${Me.X}
   /varset MyYLOC ${Me.Y}
   /delay 2
   /if (${MyXLOC}==${Me.X} && ${MyYLOC}==${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
Of course, you need to make some declare and change some pieces but, as you said, it is a starting point (maybe also some more tha a starting)

draco
a ghoul
a ghoul
Posts: 145
Joined: Thu Jan 29, 2004 7:06 pm
Contact:

Post by draco » Mon Jun 14, 2004 10:50 am

Here is a loot include I posted in snippets I use it in my bot.

http://macroquest2.com/phpBB2/viewtopic.php?t=7485

It uses ini files and does some things like keep track of stats. But, if you look at the lootMob subroutine you can see how to handle the lootWnd, etc.