I've tried to rewrite the handin.mac I made some time back, to the new MQ2Data format, here is what I got so far. I was hoping someone could doublecheck it for me and point out any errors they see, thanks in advance :)
Code: Select all
| handin.mac
|
| Author(s):
| - Kagonis
| - Corrections and suggestions by various people..
| SukMage
| DKAA
| Wassup
|
| Description:
| - Used to make handins to NPCs, nifty for those who
| doesn't feel like getting carpal tunnel syndrome to
| complete a quest that requires a lot of hand ins.
|
| Usage:
| - /macro handin.mac <pp|gp|sp|cp|"Item Name"> <amount> ["destroy"]
| The you must type "destroy" for the macro to destroy items returned.
|
| Example:
| - /macro handin.mac "Batwing" 4 "destroy"
| Will hand in 4 Batwing's and destroy the item(s) returned from the NPC.
Sub Main(string TheItem, int TheAmount, string DoDestroy)
/declare Loopcount int local
/declare Timeout timer local
:GiveItem
/if (!${Defined[TheItem]} || !${Defined[TheAmount]}) /call Syntax
/for Loopcount 1 to ${TheAmount}
/if (${TheItem.Equal[pp]}) {
/ctrl /notify InventoryWindow IW_Money0 leftmouseup
} else /if (${TheItem.Equal[gp]}) {
/ctrl /notify InventoryWindow IW_Money1 leftmouseup
} else /if (${TheItem.Equal[sp]}) {
/ctrl /notify InventoryWindow IW_Money2 leftmouseup
} else /if (${TheItem.Equal[cp]}) {
/ctrl /notify InventoryWindow IW_Money3 leftmouseup
} else {
/ctrl /itemnotify ${FindItem[${TheItem}].InvSlot} leftmouseup
}
:WaitForItem
/varset Timeout 5s
/if (!${Cursor.ID}) {
/if (!${Timeout.Value}) /goto :Done
/delay 0
/goto :WaitForItem
}
/click left target
:Wait
/varset Timeout 10s
/if (${Cursor.ID}) {
/if (!${Timeout.Value}) /goto :Done
/delay 0
/goto :Wait
}
/next Loopcount
/click left npctrade give
/delay 5
:ClearCursor
/if (${Cursor.ID}) {
/if (${Defined[DoDestroy]} && ${DoDestroy.Equal[destroy]}) {
/destroy
} else {
/autoinv
}
/delay 0
/goto :ClearCursor
}
/goto :GiveItem
:Done
/endmacro
/return
Sub Syntax
/echo Syntax: /macro handin <pp|gp|sp|cp|"Item Name"> <#> [destroy]
/echo ..
/echo Example: /macro handin gp 2 destroy
/echo Will hand in 2 pieces of gold to the targeted NPC and then click give, and will destroy anything you get back on your cursor.
/echo ..
/echo Example: /macro handin "Batwing" 4
/echo Will hand in 4 batwings to the targeted NPC and then click give, and will keep anything you get back on your cursor.
/endmacro
/return
Edit: Found replacements for the obsolote commands I was using, thanks to DKAA :)
This should by the final working version, allthough I need to test it (and find something to test it on where I'm not KoS as a low leezurd).
Edit: Used SukMage's suggestions for use with /notify for picking up coins instead of the old /mouseto plat etc. method. Thanks :)
Fixed the error that SukMage found (I hope). Needed to use Timeout.Value[0] instead of Timeout.Equal[0].
Edit: Fixed some errors pointed out by Wassup ${amount} wasn't declared cause it was supposed to be ${TheAmount}. Sorry about that one.
Took some highlights from Wassup's code along, stil not sure what's wrong with them.. It's supposed to be Timeout.Value.Equal[0] instead?
Edit: Should be fully converted now, just me that is slow and didn't understand what Wassup was trying to tell me in his first post, thanks Wassup :)
Moving this to Macro Depot now, thanks for all the help guys/girls :)



