Loot.mac [Loots the mob you(Or ur pet) just killed]

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

TheWarden
a hill giant
a hill giant
Posts: 253
Joined: Sat Dec 27, 2003 3:51 pm
Location: In your bushes...

Loot.mac [Loots the mob you(Or ur pet) just killed]

Post by TheWarden » Mon Aug 30, 2004 8:49 pm

OK, thanks to Mister Peepers I was able to fix the problem I was having with this macro(what a stupid problem it was too, Haha).

It will target the mobs corpse that you or ur pet killed(It will NOT loot corpses of mobs others have killed). It will target the nearest corpse that is within a radius of 100.

Change "/declare LootAllItems int outer 1" to 0 if you want it to read from hunterloot.ini I instead of looting all items(It will destroy any items not in the hunterloot.ini file)

Macro:

Code: Select all

|------------------------------------------------------------
| Name: Loot.mac
|------------------------------------------------------------
| Description: Loots mobs that you or your pet kills.
|------------------------------------------------------------
| Author: TheWarden (helped by DKAA)
|------------------------------------------------------------
| Example Uses:
|    /macro loot.mac
|------------------------------------------------------------


#Event MobDied "#*# has been slain by |${Me.Pet.CleanName}|!"
#Event MobDied "#*#You have slain #*#"

Sub Main

|------------------------------------------------------------
|Should I loot all items? (1 for yes, 0 for no)
|------------------------------------------------------------
    /declare LootAllItems     int outer  1


|------------------------------------------------------------
|Loot Array Information.
|------------------------------------------------------------
    /call ReadINI HunterLoot.ini "${Zone.Name}" Loot
    /if (!${Defined[LootArray]}) {
       /echo No Loot Array Created...
    }


|------------------------------------------------------------
|Variables that you don't need to worry about.
|------------------------------------------------------------
    /declare LootSlot         int outer  0



    /echo Starting Looting Macro.
    /lootnodrop never

:eventloop
    /doevents
    /delay 5
    /goto :eventloop
/return


|--------------------------------------------------------------------------------
|Event: MobDied
|--------------------------------------------------------------------------------
Sub Event_MobDied

    /squelch /declare LootSlot    int inner  0
    /declare LootCheck   int inner  0
    /declare LootTotal   int inner  0

    /target npc corpse radius 200

:MovementLoop
    /face fast nolook
    /if (${Int[${Target.Distance}]}>13) {
       /keypress forward hold
    }
    /if (${Int[${Target.Distance}]}<13&&${Int[${Target.Distance}]}>11) {
       /keypress forward
    }
    /if (${Int[${Target.Distance}]}<9) {
       /keypress back
    }
    /if (${Int[${Target.Distance}]}>13) {
       /goto :MovementLoop
    }
    /keypress forward
    /keypress back

    /delay 5
    /loot

:NotOpen
    /if (${Window[LootWnd].Open}) {
       /goto :Lalala
    }
    /goto :NotOpen

:Lalala
    /delay 5
    /if (!${Corpse.Items}) {
       /echo NO LOOT! Cheap Bastard!
       /notify LootWnd DoneButton leftmouseup
       /delay 5
       /return
    }

    /varset LootTotal ${Corpse.Items}
    /for LootSlot 1 to ${LootTotal}
    /itemnotify loot${LootSlot} leftmouseup

:LootWait
      /if (!${Cursor.ID}) {
         /goto :LootWait
      }
      /delay 5
      /if (${LootAllItems}) {
         /echo Keeping a ${Cursor.Name}... WOOT!
         /autoinventory
         /delay 5
      } else {
         /for LootCheck 1 to ${LootArray.Size}
            /if (${Cursor.Name.Find[${LootArray[${LootCheck}]}]}) {
               /echo Keeping a ${Cursor.Name}... WOOT!
               /autoinventory
               /delay 5
            }
         /next LootCheck
     }
     /if (${Cursor.ID}) {
        /echo Destroying a ${Cursor.Name}...
        /destroy
        /delay 5
     }
     /next LootSlot
 
    /notify LootWnd DoneButton leftmouseup
    /delay 5
 
/return


|--------------------------------------------------------------------------------
|SUB: Reading from an INI File
|--------------------------------------------------------------------------------
Sub ReadINI(FileName,SectionName,ArrayType)

    /echo Attempting to Read Section "${SectionName}" Zone Information from ${FileName}...
    /delay 10
 
    /if (${Ini[${FileName},${SectionName},-1,NO].Equal[NO]}) {
       /echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending macro...
       /delay 10
       /return
    }
    /declare nValues     int local  1
    /declare nArray      int local  0
    /declare KeySet      string local  ${Ini[${FileName},${SectionName}]}

:CounterLoop
    /if (${Ini[${FileName},${SectionName},${ArrayType}${nValues},NOTFOUND].Equal[NOTFOUND]}) {
       /varcalc nValues ${nValues}-1
       /goto :MakeArray
    }
    /varcalc nValues ${nValues}+1
    /goto :CounterLoop

:MakeArray
    /if (!${nValues}) /return
    /if (${FileName.Equal["HunterMob.ini"]}&&${nValues}>0) {
       /echo Declaring Mob Array...
       /declare MobArray[${nValues}]   string outer
       /declare MobStats[${nValues}]   string outer
    }
    /if (${FileName.Equal["HunterLoot.ini"]}&&${nValues}>0) {
       /echo Declaring Loot Array...
       /declare LootArray[${nValues}]  string outer
       /declare LootStats[${nValues}]  string outer
    }
    /for nArray 1 to ${nValues}
       /if (${FileName.Equal["HunterMob.ini"]}) {
       /varset MobArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}${nArray}]}
       /varset MobStats[${nArray}] 0
    }
    /if (${FileName.Equal["HunterLoot.ini"]}) {
       /varset LootArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}${nArray}]}
       /varset LootStats[${nArray}] 0
    }
    /next nArray
 
    /echo "${SectionName}" Zone Information Read Successfully from ${FileName}...
    /delay 10
 
/return

hunterloot.ini:

Code: Select all

[Kurn's Tower] 
Loot1=Bone Chips

[The Mines of Gloomingdeep] 
Loot1=Bone Chips
Loot2=Gloomingdeep Silk
Last edited by TheWarden on Mon Jul 04, 2005 3:22 pm, edited 3 times in total.
[img]http://img.photobucket.com/albums/v629/Deevious/SigPics/KristinKreukSig01.jpg[/img]

TheWarden
a hill giant
a hill giant
Posts: 253
Joined: Sat Dec 27, 2003 3:51 pm
Location: In your bushes...

Post by TheWarden » Tue Aug 31, 2004 9:30 pm

I think ima redo the entire macro from scratch tomorrow... I need to work up my skills :D
[img]http://img.photobucket.com/albums/v629/Deevious/SigPics/KristinKreukSig01.jpg[/img]

Chumpydasquirel
decaying skeleton
decaying skeleton
Posts: 5
Joined: Sat Jan 01, 2005 11:27 pm

dumb ?

Post by Chumpydasquirel » Wed Jan 12, 2005 10:33 pm

on the hunter.ini i can add in other zones and what i want looted there correct?

Neolesh
a hill giant
a hill giant
Posts: 231
Joined: Mon Aug 23, 2004 11:15 am

Post by Neolesh » Thu Jan 13, 2005 3:29 am

Okay maybe I'm missing something obvious but..

Code: Select all

     /declare LootCheck   int inner  0 
     /declare LootTotal   int inner  0
I checked the documentation and I can't find inner vartypes or how they behave listed anywhere.

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Thu Jan 13, 2005 5:03 am

it should generate an error. i think he was shooting for local.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Re: dumb ?

Post by aChallenged1 » Thu Jan 13, 2005 6:47 am

Chumpydasquirel wrote:on the hunter.ini i can add in other zones and what i want looted there correct?
Yes.

If you have the Hunter.mac you likely already have this INI file and can edit that one.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!