PDA

View Full Version : not buying HP pots but buying manas? lost!



dean015
01-31-2016, 06:33 PM
Hello, i have a small problem my script is buying manas fine but not HP pots, can someone please take a look i would appreciate it


local MPBuy = 700 --- Manas to buy
local MPLeave = 100 --- Manas to refill
local ManaPots = 268 --- Mana IDs small=268 - strong=237 - great=238

local HPBuy = 30 --- Healths to buy
local HPLeave = 15 --- Healths to refill
local HPID = 239 --- Health IDs small=266 - strong=236 - great=239


Self.ShopBuyItemsUpTo(ManaPots, MPBuy)
wait(1900,2400)
Self.ShopBuyItemsUpTo(HPID, HPBuy)


Self.WithdrawMoney((50*(MPBuy-Self.ItemCount(ManaPots)))+1000)
wait(1800,2400)
Self.WithdrawMoney(80*(HPBuy-Self.ItemCount(HPID)))


it looks right to me but i have no idea what im doing :/ its also not withdrawing enough money for the hp pots


thanks

Jontor
01-31-2016, 07:12 PM
Use Item.GetCost(id) to get your supply cost + you don't need a wait between buying two different types of potions

dean015
01-31-2016, 07:22 PM
Use Item.GetCost(id) to get your supply cost + you don't need a wait between buying two different types of potions

thanks for the reply, could you show me where i would put this into the code? and is this whats causing it not to buy the hp pots? i have no idea what im doing

dean

Jontor
01-31-2016, 07:39 PM
thanks for the reply, could you show me where i would put this into the code? and is this whats causing it not to buy the hp pots? i have no idea what im doing

dean

When withdrawing:


Self.WithdrawMoney(math.max(Item.GetCost(ManaPots) * (MPBuy - Self.ItemCount(ManaPots)), 0) + math.max(Item.GetCost(HPID) * (HPBuy - Self.ItemCount(HPID)), 0))


Rest looks fine, you were probably missing money when trying to buy items