autoloot.inc

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot.

Moderator: MacroQuest Developers

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

autoloot.inc

Post by Mckorr » Mon Jan 26, 2004 3:48 pm

Grimjack put this together for me a while back. Instructions are in the leading comments.

Code: Select all

|autoloot.inc
|
| Code to move close enough to loot from L124RD's MacroKit
| Autolooting code by grimjack
|
| For use as an include
| usage /call LootUp "item1" "item2"
| Will accept up to 8 items, items must be one word
|

Sub LootUp

   /declare t0 timer
   /declare LootSlot global
   /declare CheckLoot global
   /declare LootTotal global
   /declare LootArray array

   /if n $target(distance)>75 /goto :continue
   /stand
   /face
   /if n $target(distance)<15 /goto :CloseEnoughAL
   /sendkey down up
   /varset t0 3m
   :CloserAL
   /face
   /delay 0
   /if n $target(distance)>14 /if @t0>0 /goto :CloserAL

   :CloseEnoughAL
   /sendkey up up

   /varset LootSlot 0
   /varset CheckLoot 0
   /if @Param0=="" {
      /echo "Usage: /call LootUp [item to keep] [item to keep]...ect"
      /return
   }
   /if @Param0!="" {
      /varset LootArray(0) @Param0
      /varset LootTotal 1
   }
   /if @Param1!="" {
      /varset LootArray(1) @Param1
      /varset LootTotal 2
   }
   /if @Param2!="" {
      /varset LootArray(2) @Param2
      /varset LootTotal 3
   }
   /if @Param3!="" {
      /varset LootArray(3) @Param3
      /varset LootTotal 4
   }
   /if @Param4!="" {
      /varset LootArray(4) @Param4
      /varset LootTotal 5
   }
   /if @Param5!="" {
      /varset LootArray(5) @Param5
      /varset LootTotal 6
   }
   /if @Param6!="" {
      /varset LootArray(6) @Param6
      /varset LootTotal 7
   }
   /if @Param7!="" {
      /varset LootArray(7) @Param7
      /varset LootTotal 8
   }

/if $target()=="TRUE" /call LootMob
/call ResetSub
/return

sub LootMob
   /loot
   /delay 7
   :lootloop
   /click left corpse @LootSlot
   /delay 7
   /if "$cursor()"!="TRUE" /goto :doneloot
   :lootChecker
   /if "$cursor(name)"~~@LootArray(@CheckLoot) {
      /delay 7
      /click left auto
      /varadd LootSlot 1
      /goto :lootloop
   }
   /varadd CheckLoot 1
   /if "$cursor()"=="TRUE" {
      /if @CheckLoot<@LootTotal /goto :lootchecker
   }
   /if "$cursor()"=="TRUE" {
      /delay 7
      /click left destroy
      /delay 7
   }
   /varadd LootSlot 1
   /varset CheckLoot 0
   /goto :lootloop
   :doneloot
   /varset LootSlot 0
/return


sub ResetSub
   /press esc
   /press esc
   /press esc
   /press esc
   /press alt
   /press shift
   /press ctrl
   /varset CheckLoot 0
   /varset LootSlot 0
   /delay 7
/return

ImaNoob
a ghoul
a ghoul
Posts: 89
Joined: Mon Mar 08, 2004 4:37 am

Modification?

Post by ImaNoob » Thu Mar 18, 2004 8:36 pm

Would it possible to set this up to automatically loot no drop items, and destroy duplicate lore items? Otherwise these things tend to go into an infinite loop.

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Re: Modification?

Post by Bad Karma » Fri Mar 19, 2004 9:16 am

ImaNoob wrote:Would it possible to set this up to automatically loot no drop items, and destroy duplicate lore items? Otherwise these things tend to go into an infinite loop.
The problem with LORE itmes is if the item is in a Bank Slot...then you cannot destory it.
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Sat Apr 03, 2004 8:39 pm

Ok I am working on a macro to loot CHipped Gems....I want the macro to loot anything with the word CHipped in it but when I call the LootUp with "Chipped" as the item it still destroy chipped items...anyway I can tweak this so it will save them?

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Mon Apr 05, 2004 2:44 am

Yes....just make sure to do your comparison something like this (untested, so be sure to rtfm for the proper usage):

Code: Select all

/if $cursor(name)~~"Chipped" /autoinventory
Using ~~ will include the word "Chipped" anywhere in the itemname. It is case-sensitive. You'll have to look up what you'll actually be checking, as $cursor(name) is not correct. I suggest doing this using the new data types.
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

Zazoot
a hill giant
a hill giant
Posts: 163
Joined: Sat Feb 07, 2004 11:02 am

Post by Zazoot » Thu Apr 08, 2004 11:52 am

Code: Select all

   /if n $target(distance)>75 /goto :continue 
is that even nessesary?
Last edited by Zazoot on Fri Apr 09, 2004 12:03 am, edited 1 time in total.

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Thu Apr 08, 2004 2:05 pm

Yea while I ran I got ereors saying there was no :continue and when I looked through it well there wasnt. I redid mine a little to this

Code: Select all

|autoloot.inc 
| 
| Code to move close enough to loot from L124RD's MacroKit 
| Autolooting code by grimjack 
| 
| For use as an include 
| usage /call LootUp "item1" "item2" 
| Will accept up to 8 items, items must be one word 
| 

Sub LootUp 

   /declare t0 timer 
   /declare LootSlot global 
   /declare CheckLoot global 
   /declare LootTotal global 
   /declare LootArray array 

   :continue
   /face 
   /sendkey down up
   /delay 0 
   /if n $target(distance)>15 /goto :continue  
   /if n $target(distance)<15 /goto :CloseEnoughAL
   :CloseEnoughAL 
   /sendkey up up 

   /varset LootSlot 0 
   /varset CheckLoot 0 
   /if @Param0=="" { 
      /echo "Usage: /call LootUp [item to keep] [item to keep]...ect" 
      /return 
   } 
   /if @Param0!="" { 
      /varset LootArray(0) @Param0 
      /varset LootTotal 1 
   } 
   /if @Param1!="" { 
      /varset LootArray(1) @Param1 
      /varset LootTotal 2 
   } 
   /if @Param2!="" { 
      /varset LootArray(2) @Param2 
      /varset LootTotal 3 
   } 
   /if @Param3!="" { 
      /varset LootArray(3) @Param3 
      /varset LootTotal 4 
   } 
   /if @Param4!="" { 
      /varset LootArray(4) @Param4 
      /varset LootTotal 5 
   } 
   /if @Param5!="" { 
      /varset LootArray(5) @Param5 
      /varset LootTotal 6 
   } 
   /if @Param6!="" { 
      /varset LootArray(6) @Param6 
      /varset LootTotal 7 
   } 
   /if @Param7!="" { 
      /varset LootArray(7) @Param7 
      /varset LootTotal 8 
   } 

/if $target()=="TRUE" /call LootMob 
/call ResetSub 
/return 

sub LootMob 
   /loot 
   /delay 7 
   :lootloop 
   /click left corpse @LootSlot 
   /delay 7 
   /if "$cursor()"!="TRUE" /goto :doneloot 
   :lootChecker 
   /if "$cursor(name)"~~@LootArray(@CheckLoot) { 
      /delay 7 
      /click left auto 
      /varadd LootSlot 1 
      /goto :lootloop 
   } 
   /varadd CheckLoot 1 
   /if "$cursor()"=="TRUE" { 
      /if @CheckLoot<@LootTotal /goto :lootchecker 
   } 
   /if "$cursor()"=="TRUE" { 
      /delay 7 
      /click left destroy 
      /delay 7 
   } 
   /varadd LootSlot 1 
   /varset CheckLoot 0 
   /goto :lootloop 
   :doneloot 
   /varset LootSlot 0 
/return 


sub ResetSub 
   /press esc 
   /press esc 
   /press esc 
   /press esc 
   /press alt 
   /press shift 
   /press ctrl 
   /varset CheckLoot 0 
   /varset LootSlot 0 
   /delay 7 
/return