Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- |
- | buy.inc
- | Buy Include File needed for macros
- | Version 1.7b
- |
- | Date: August 20, 2005
- | UPDATED BY OUNVME
- |
- | 14 MAR 2006: Armysoldier refined code to improve speed
- |
- | Please be sure to get the lastest updates at http://www.soc-music.com/mq2
- |
- | These file MUST be in the common directory in your macros directory.
- |
- | Usage: /call Buy (ItemToBuy) (Amount Needed)
- |
- | Use the Buy function for buying if you need a set total amount, like if you have
- | 20 of the item on you already and you need a total of 30, it will only buy 10
- | of the item.
- |
- | Usage: /call PCBuy (ItemToBuy) (Amount to buy off merchant)
- |
- | Use the PCBuy function if you don't need a set total amount, you just need
- | a set amount off that merchant.
- |
- | Disclaimer:
- | Code was used from other programers also from the MQ Forums.
- |
- #event Broke "#*#you cannot afford#*#"
- #event Broke "#*#you can't afford#*#"
- Sub Buy(string ItemToBuy, int amount)
- /echo Buying ${amount} ${ItemToBuy}(s)!
- /declare QTY int local ${Math.Calc[${amount}-${FindItemCount[${ItemToBuy}]}]}
- /declare l2 int local
- /delay 5s ${Window[MerchantWnd].Child[ItemList].List[=${ItemToBuy},2]}
- /if (${FindItemCount[${ItemToBuy}]}>= ${amount}) {
- /echo ${amount} ${ItemToBuy} already in inventory.
- /return
- }
- /varset l2 ${Window[MerchantWnd].Child[ItemList].List[=${ItemToBuy},2]}
- /if (!${l2}) {
- /echo couldn't find ${ItemToBuy}
- /endmacro
- } else {
- /notify MerchantWnd ItemList listselect ${l2}
- /notify MerchantWnd ItemList leftmouse ${l2}
- /delay 2
- }
- /echo Buying ${ItemToBuy} Till I get ${amount}
- :Loop
- /if (${QTY}>19 && ${FindItem[=${ItemToBuy}].Stackable} && ${FindItem[=${ItemToBuy}].StackSize}<=${amount} ) {
- /nomodkey /shiftkey /notify MerchantWnd MW_Buy_Button leftmouseup
- } else {
- /nomodkey /ctrlkey /notify MerchantWnd MW_Buy_Button leftmouseup
- }
- /delay 5
- /doevents
- /varset QTY ${Math.Calc[${amount}-${FindItemCount[${ItemToBuy}]}]}
- /if (${QTY}<=0) /return
- /goto :Loop
- /return
- Sub Event_Broke
- /echo Error: You are out of money!
- /beep
- /endmacro
- /return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement