Advertisement
Guest User

Untitled

a guest
Nov 11th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.37 KB | None | 0 0
  1. ub Buy(string ItemToBuy, int amount)
  2.     /if (!${Select[${Target.Type},npc,pet]} || !${Target.ID} || ${Target.Type.Equal[pet]} && !${Target.CleanName.Find[familiar]}) /return
  3.     /declare i int local
  4.     | /echo Buying ${ItemToBuy}!
  5.     /declare QTY int local
  6.     /declare ListItem int local
  7.     /varcalc QTY ${amount}-${FindItemCount[${ItemToBuy}]}
  8.     /delay 3
  9.     /if (${FindItemCount[${ItemToBuy}]}>=${amount}) {
  10.         /echo I already have ${FindItemCount[${ItemToBuy}]} ${ItemToBuy}.
  11.         /return
  12.     }  
  13.     /varset ListItem ${Window[MerchantWnd].Child[ItemList].List[=${ItemToBuy},2]}
  14.     /if (!${ListItem}) {
  15.         /echo couldn't find ${ItemToBuy}
  16.        /return
  17.    } else {
  18.        /notify MerchantWnd ItemList listselect ${ListItem}
  19.        /delay 5      
  20.    }
  21.    /echo Buying ${ItemToBuy} Till I get ${amount}
  22.    :Loop
  23.    /doevents
  24.    /if (${InventoryFull}) /return
  25.    /if (${QTY}>0) {
  26.        /if (${QTY}>19) {
  27.            /Shiftkey /notify merchantwnd MW_Buy_Button leftmouseup
  28.            /delay 5 ${FindItemCount[B${ItemToBuy}]}>=${QTY}
  29.            /echo ${FindItemCount[${ItemToBuy}]}/${amount} ${ItemToBuy} in inventory
  30.            /varcalc QTY ${amount}-${FindItemCount[${ItemToBuy}]}
  31.            /if (${QTY}<=0) {
  32.                /if (${Window[MerchantWnd].Open}) {
  33.                    /echo Closing merchant window
  34.                    /nomodkey /notify MerchantWnd MW_Done_Button LeftMouseUp
  35.                }
  36.                /return
  37.            }
  38.            /delay 5
  39.            /if (${QTY}>19) /goto :Loop
  40.        }
  41.        /if (${QTY}>0 && ${QTY}<20) {
  42.            /for i 1 to ${QTY}
  43.                /Ctrlkey /notify merchantwnd MW_Buy_Button leftmouseup
  44.                /delay 1s ${FindItemCount[${ItemToBuy}]}>=${Math.Calc[${FindItemCount[${ItemToBuy}]}+${i}]}
  45.                /echo Buying ${ItemToBuy} ${i} of ${QTY}
  46.                /if (${i}>=${QTY}) {
  47.                    /echo ${FindItemCount[${ItemToBuy}]} ${ItemToBuy} in inventory
  48.                    /if (${Window[MerchantWnd].Open}) {
  49.                        /echo Closing merchant window
  50.                        /nomodkey /notify MerchantWnd MW_Done_Button LeftMouseUp
  51.                    }
  52.                    /return
  53.                }
  54.            /next i
  55.            /varcalc QTY ${amount}-${FindItemCount[${ItemToBuy}]}
  56.            
  57.        }
  58.    }
  59. /return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement