PDA

View Full Version : Make a refiller script... why this error?



Super Toon
01-24-2016, 11:09 PM
This is my script i trate to make a Hive - Antenna tasker and this is the code:

--[[Variables]]--

local ManaPotID = 237 -- ID of mana potion (237 strong mana potion)
local ManaPotCost = 80 -- Cost of each mana potion (80 strong mana potion, 120 great mana potion)
local MinManaPot = 50 -- Mininum mana potion
local MaxManaPot = 400 -- Maximum mana pots to buy

--[[################################################## ######]]--
--[[##########NOTHING BELOW HERE SHOULD BE CHANGED##########]]--
--[[################################################## ######]]--

--[[LABEL MANAGER]]--
displayInformationMessage("Hive Antenna Tasker by pepito")
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName)


--[[RefillPotions]]--
elseif (labelName == "WithdrawCash") then
print("Withdrawing Cash")
Walker.Stop()
Self.SayToNpc({"hi", "deposit all", "yes", "balance"}, 60, 5)
local totalManaCost = math.abs((ManaPotCost*(MaxManaPot-Self.ItemCount(ManaPotID))))
local totalmoneyneeded = (totalManaCost)
wait(100,300)
local MATHCEIL = (math.ceil((totalmoneyneeded/1000)))*1000
if (MATHCEIL > 0) then
wait(700,1400)
Self.WithdrawMoney(MATHCEIL)
wait(500,900)
end
Walker.Start()

--[[BuyPotions&Runes]]--
elseif (labelName == "BuyPotions") then
print("Buying Potions")
Walker.Stop()
Self.SayToNpc({"hi", "vial", "yes", "yes", "trade", "magic"}, 65)
wait(900, 1200)
Self.ShopBuyItemsUpTo(ManaPotID, MaxManaPot)
wait(500,900)
Self.ShopBuyItemsUpTo(ManaPotID, MaxManaPot)
wait(500,900)
Self.ShopBuyItemsUpTo(ManaPotID, MaxManaPot)
wait(500,900)
Self.ShopBuyItemsUpTo(ManaPotID, MaxManaPot)
wait(500,900)
Self.ShopBuyItemsUpTo(ManaPotID, MaxManaPot)
wait(500,900)
Self.ShopBuyItemsUpTo(ManaPotID, MaxManaPot)
wait(500,900)
Walker.Start()

registerEventListener(WALKER_SELECTLABEL, 'onWalkerSelectLabel')
function onWalkerSelectLabel(labelName)
elseif labelName == 'CheckSupplies' then
Walker.ConditionalGoto(Self.Cap() < LeaveCap or Self.ItemCount(237) < MinManaPot, 'Refill', 'ContinueHunt')
end
end

And this is the error:
http://www.speedyshare.com/sMYZR/9163bef1/download/hive.png

Oscagi
01-25-2016, 07:53 AM
upload the pic on the forum and I will check it.

BTW,I dont see the variable of LeaveCap.

Jontor
01-25-2016, 10:16 AM
You can't just copy-paste it from somewhere else and expect it to work :/
Take a look here (http://forums.xenobot.net/showthread.php?40738-Refiller-question&p=470156&viewfull=1#post470156) and try to play around with 'Advanced Waypoints' in Xenobot to make an afk script