Page 1 of 1

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

Posted: Mon Aug 30, 2004 8:49 pm
by TheWarden
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

Posted: Tue Aug 31, 2004 9:30 pm
by TheWarden
I think ima redo the entire macro from scratch tomorrow... I need to work up my skills :D

dumb ?

Posted: Wed Jan 12, 2005 10:33 pm
by Chumpydasquirel
on the hunter.ini i can add in other zones and what i want looted there correct?

Posted: Thu Jan 13, 2005 3:29 am
by Neolesh
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.

Posted: Thu Jan 13, 2005 5:03 am
by dont_know_at_all
it should generate an error. i think he was shooting for local.

Re: dumb ?

Posted: Thu Jan 13, 2005 6:47 am
by aChallenged1
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.