Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ub Buy(string ItemToBuy, int amount)
- /if (!${Select[${Target.Type},npc,pet]} || !${Target.ID} || ${Target.Type.Equal[pet]} && !${Target.CleanName.Find[familiar]}) /return
- /declare i int local
- | /echo Buying ${ItemToBuy}!
- /declare QTY int local
- /declare ListItem int local
- /varcalc QTY ${amount}-${FindItemCount[${ItemToBuy}]}
- /delay 3
- /if (${FindItemCount[${ItemToBuy}]}>=${amount}) {
- /echo I already have ${FindItemCount[${ItemToBuy}]} ${ItemToBuy}.
- /return
- }
- /varset ListItem ${Window[MerchantWnd].Child[ItemList].List[=${ItemToBuy},2]}
- /if (!${ListItem}) {
- /echo couldn't find ${ItemToBuy}
- /return
- } else {
- /notify MerchantWnd ItemList listselect ${ListItem}
- /delay 5
- }
- /echo Buying ${ItemToBuy} Till I get ${amount}
- :Loop
- /doevents
- /if (${InventoryFull}) /return
- /if (${QTY}>0) {
- /if (${QTY}>19) {
- /Shiftkey /notify merchantwnd MW_Buy_Button leftmouseup
- /delay 5 ${FindItemCount[B${ItemToBuy}]}>=${QTY}
- /echo ${FindItemCount[${ItemToBuy}]}/${amount} ${ItemToBuy} in inventory
- /varcalc QTY ${amount}-${FindItemCount[${ItemToBuy}]}
- /if (${QTY}<=0) {
- /if (${Window[MerchantWnd].Open}) {
- /echo Closing merchant window
- /nomodkey /notify MerchantWnd MW_Done_Button LeftMouseUp
- }
- /return
- }
- /delay 5
- /if (${QTY}>19) /goto :Loop
- }
- /if (${QTY}>0 && ${QTY}<20) {
- /for i 1 to ${QTY}
- /Ctrlkey /notify merchantwnd MW_Buy_Button leftmouseup
- /delay 1s ${FindItemCount[${ItemToBuy}]}>=${Math.Calc[${FindItemCount[${ItemToBuy}]}+${i}]}
- /echo Buying ${ItemToBuy} ${i} of ${QTY}
- /if (${i}>=${QTY}) {
- /echo ${FindItemCount[${ItemToBuy}]} ${ItemToBuy} in inventory
- /if (${Window[MerchantWnd].Open}) {
- /echo Closing merchant window
- /nomodkey /notify MerchantWnd MW_Done_Button LeftMouseUp
- }
- /return
- }
- /next i
- /varcalc QTY ${amount}-${FindItemCount[${ItemToBuy}]}
- }
- }
- /return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement