Loot.mac - Much improved version
Posted: Mon May 03, 2004 10:41 am
This is my first macro of any consequence based on Bob the Builders Loot.mac macro but with a lot of added code to smooth looting out and account for lag/etc.
Improvements made:
1. Commented the code
2. Make sure ya have your corpse targetted before trying to loot.
3. If corpse can't be summoned close enough to loot, abort looting and face your corpse.
4. Try to get a accurate corpse item count to do all looting at one time. Should help in laggy enviroments a lot.
5. Give an error if trying to leave more items on the corpse than there are items.
6. Won't accidently loot last item unless /mac loot 0 is specified.
7. Will now loot items the first time around even with lag and pretty fast once looting begins.
8. Added code tags now that I know how. See! I'm learning!
Updated 05/07/04
1. Mostly cleanup and implimentations of things a little differently using new things I've learned.
2. Now checks for your corpse by name.
3. If a corpse was completely empty, it won't come off it so you have a chance to get a resurrection before ya pop off it automatically.
4. You can now set LootingLag to the # of seconds to wait between item count updates to make sure you're getting all items in 1 looting.
Improvements made:
1. Commented the code
2. Make sure ya have your corpse targetted before trying to loot.
3. If corpse can't be summoned close enough to loot, abort looting and face your corpse.
4. Try to get a accurate corpse item count to do all looting at one time. Should help in laggy enviroments a lot.
5. Give an error if trying to leave more items on the corpse than there are items.
6. Won't accidently loot last item unless /mac loot 0 is specified.
7. Will now loot items the first time around even with lag and pretty fast once looting begins.
8. Added code tags now that I know how. See! I'm learning!
Updated 05/07/04
1. Mostly cleanup and implimentations of things a little differently using new things I've learned.
2. Now checks for your corpse by name.
3. If a corpse was completely empty, it won't come off it so you have a chance to get a resurrection before ya pop off it automatically.
4. You can now set LootingLag to the # of seconds to wait between item count updates to make sure you're getting all items in 1 looting.
Code: Select all
| Revision Date: 05/07/04 Time: 5:33am cst
#Event CorpseTooFar "The corpse is too far away to summon."
Sub main
/declare LootTotal int -1
/declare LootSlot int
/declare LootLeft int ${Param0}
/declare Loop int
/declare CorpseName string ${Me.Name}'s corpse
| Some extra lag compensation for EQWing multiple toons (Like me) so looting is more reliable in the background.
| Set LootingLag to the number of seconds to wait for updates to the Loot Total count before assuming all loot accounted for.
/declare LootingLag int 3
| Check number items to be left on corpse specified. If not, default to 1 and explain parameter.
/if (!${Defined[Param0]}) {
/varset LootLeft 1
/echo Using default LootLeft of ${LootLeft}
/call MacroParams
}
| Get corpse on target and continue if able to target your corpse.
/target mycorpse
/if (${CorpseName.NotEqual[${Target.CleanName}]}) {
/popup Unable to target your corpse.
/echo Unable to target your corpse.
/endmacro
}
:PullCorpseClose
/corpse
/loot
/delay 1s
/doevents
/if (${Me.State.NotEqual[BIND]}) /goto :PullCorpseClose
| Try to get a accurate corpse item count to do all looting at one time.
:LootLag
/delay 1s
/if (${LootTotal}!=${Corpse.Items}) {
/varset LootTotal ${Corpse.Items}
/varset Loop 0
/goto :LootLag
} else {
/varcalc Loop ${Loop}+1
/if (${Loop}<${LootingLag}) /goto :LootLag
}
| Just some extra safety.
/if (${LootTotal}==0) {
/popup This corpse appears to be empty.
/echo This corpse appears to be empty. If it needs a resurrection, ya better hurry before ya automatically come off the corpse.
/endmacro
}
| Make sure not to loot to much/completely accidently.
/if (${LootTotal}<=${LootLeft}) {
/popup Looting aborted. Error in number items to be left on corpse. Found ${LootTotal} lootable item(s)
/echo Looting aborted. Error in number items to be left on corpse. Found ${LootTotal} lootable item(s)
/call MacroParams
/notify LootWnd DoneButton leftmouseup
/endmacro
}
| Set the number of items to actually loot leaving LootLeft number items on the corpse.
/varset LootTotal ${Math.Calc[${Corpse.Items}-${LootLeft}]}
/popup Looting all but ${LootLeft} item(s)
|Main Looting Loop
/for LootSlot 1 to ${LootTotal}
| Loot all items fast the first time around even with connection lag or the lag when looting bags.
:LootItem
/itemnotify loot${LootSlot} rightmouseup
/delay ${LootingLag}
/if (${Corpse.Item[${LootSlot}].ID}==NULL) {
/next LootSlot
} else {
/delay ${LootingLag}
/goto :LootItem
}
:DoneLooting
/notify LootWnd DoneButton leftmouseup
/popup Done looting. ${LootLeft} Item(s) left on your corpse.
/echo Done looting. ${LootLeft} Item(s) left on your corpse.
/endmacro
Sub MacroParams
/echo Useage: /mac loot <# items to leave on corpse>
/echo Useage: /mac loot 0 <Loots all items>
/return
Sub Event_CorpseTooFar
/echo Corpse to far away to summon. Macro Ending.
/popup Corpse to far away to summon.
/face
/endmacro