PDA

View Full Version : ShopBuyItem



Raggaer
05-19-2016, 02:19 PM
Im currently trying to do the following




local maxMana = 400
local minMana = 60

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(label)
if label == "Start" then
if Self.ItemCount(268) <= minMana then
Walker.Goto("Supply")
end
end
if label == "Withdraw" then

Self.WithdrawMoney(20000)
end
if label == "Buy" then
print(Self.ShopBuyItem(268, (manaMax - Self.ItemCount(268))))
end
end

The problem comes at my Buy label I am getting this error and I am not sure why

http://4.1m.yt/RcmFEeZ.png

Oscagi
05-19-2016, 03:34 PM
Im currently trying to do the following




local maxMana = 400
local minMana = 60

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(label)
if label == "Start" then
if Self.ItemCount(268) <= minMana then
Walker.Goto("Supply")
end
end
if label == "Withdraw" then

Self.WithdrawMoney(20000)
end
if label == "Buy" then
print(Self.ShopBuyItem(268, (manaMax - Self.ItemCount(268))))
end
end

The problem comes at my Buy label I am getting this error and I am not sure why

http://4.1m.yt/RcmFEeZ.png

First bug I saw, its on ur print u added manaMax, and ypu have maxMana on you mana option.
Second, when u want print something u have to add 1 more () or you will have bug when u put a ",". Also u can make like:
Buy = Self.ShopBuyItem(268, (maxMana - Self.ItemCount(268)))
print(Buy)


local maxMana = 400
local minMana = 60

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(label)
if label == "Start" then
if Self.ItemCount(268) <= minMana then
Walker.Goto("Supply")
end
end
if label == "Withdraw" then

Self.WithdrawMoney(20000)
end
if label == "Buy" then
print((Self.ShopBuyItem(268, (maxMana - Self.ItemCount(268)))))
end
end

Fatality
05-20-2016, 12:01 AM
local maxMana = 400
local minMana = 60

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(label)
if label == "Start" then
if Self.ItemCount(268) <= minMana then
Walker.Goto("Supply")
end
elseif label == "Withdraw" then
Self.WithdrawMoney(20000)
elseif label == "Buy" then
--print(Self.ShopBuyItem(268, (manaMax - Self.ItemCount(268))))
-- No fucking clue why you're printing this^^
Self.ShopBuyItemsUpTo(268, maxMana)
-- ^ This code buys up to 400 of item "268"
end
end

Raggaer
05-20-2016, 02:29 PM
I am still getting the error. I was printing it to see the output.

No idea what I am doing wrong tho heres my simple new code



if label == "Potion" then
wait(200, 200)
Self.ShopBuyItemsUpTo(268, 600)
wait(500, 500)
end

And heres where the character is

http://2.1m.yt/69Ztl6V.png

And I am getting the exact same error if I print the output of ShopBuyItemsUpTo :_S

Oscagi
05-20-2016, 04:10 PM
I am still getting the error. I was printing it to see the output.

No idea what I am doing wrong tho heres my simple new code



if label == "Potion" then
wait(200, 200)
Self.ShopBuyItemsUpTo(268, 600)
wait(500, 500)
end

And heres where the character is

http://2.1m.yt/69Ztl6V.png

And I am getting the exact same error if I print the output of ShopBuyItemsUpTo :_S

Maybe u should add
Self.SaytoNpc({'hi', 'trade'}, 70) ?
On Potion label.

felipe93
05-21-2016, 06:12 AM
Maybe u should add
Self.SaytoNpc({'hi', 'trade'}, 70) ?
On Potion label.

im using these codes but when the char reach the npc and open trade channel get stuck and dont but anything


local AmmoName = "Royal Spear" --- What ammunition are you using?
local LeaveAmmo = 10 --- How much ammunition until you leave hunt?
local BuyAmmo = 45 --- How much ammunition do you begin the hunt with?
local AmmoCost = 15 --- What is the cost of your selected ammunition?
--------------------------------------------------------------------------
----------------------------------------------------------------------------

Oscagi i need this same functions but to buy spears





elseif (labelName == "BuySpears") then
--------------------------------- TODO -------------------------
Walker.Stop()
Self.SayToNpc({"hi", "trade"}, 100)
-- Buy spears, make sure Self.ItemCount returns items in hands.
while (Self.ItemCount(AmmoID) < BuyAmmo) do
Self.ShopBuyItemsUpTo(AmmoID, BuyAmmo)
wait(500,800)