Log in

View Full Version : Error in .LUA script..



DarkRoses
07-15-2013, 01:27 PM
What is wrong with this? I've tried to fix it myself but it does not work. I've searched but couldn't find an answer.
error im getting:
Line #: 190
Chunk: C:\Users\Mathias\Documents\XenoBot\Scripts\[ED] Banuta -1 Action.lua
Error: 'end' expected (to close 'function' at line 51) near '<eof>'
This is an error with user-input and should not be reported as a bug with XenoBot.


local MinMana = 65 --- How many mana potions until you leave the hunt?
local MaxMana = 200 --- How many mana potions you begin the hunt with?
local MinSD = 200 --- How much ammunition until you leave hunt?
local MaxSD = 1200 --- How much ammunition do you begin the hunt with?
local ExtraWithdraw = 1000
------------------------------
--- Backpack Configuration ---
------------------------------
local GoldBP = "Brocade Backpack"
---------------------
--- Extra Options ---
---------------------
local LeaveCap = 100 --- Leaves spawn when character reaches this cap.
local HideEquipment = true --- Do you want to minimize your equipment?
local LogoutStamina = true --- Do you want to logout at 16 hours? (Inside the depot)

-------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------- DONT TOUCH IF YOU DONT KNOW WHAT YOU'RE DOING! ----------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------
local info = [[
Banuta -1 PH
SD Version
by DarkRoses]]

print(info)
wait(1000)

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName)
if (labelName == "checkerAll") then
Walker.ConditionalGoto((Self.ItemCount(238) <= MinMana) or (Self.Cap() < LeaveCap) or (Self.ItemCount(3155) <= MinSD), "leaveAll", "startHunt")

if (labelName == "checkerMid") then
local ESTMana = (MinMana + 20)
local ESTSD = (MinSD + 100)
Walker.ConditionalGoto((Self.ItemCount(238) <= ESTMana) or (Self.ItemCount(3155) <= ESTSD), "leaveMid", "contHunt1")

elseif (labelName == "bank") then
Walker.Stop()
Self.SayToNpc({"hi", "deposit all", "yes"}, 100)
local withdrawManas = math.max(MaxMana - Self.ItemCount(238), 0)*120
local withdrawRune = math.max(MaxSD - Self.ItemCount(3155), 0)*108
local TOTAL = math.abs(withdrawManas + withdrawRune + ExtraWithdraw)
if total >= 1 then
print("Withdrawing" .. TOTAL)
Self.SayToNpc({"withdraw " .. TOTAL, "yes", "balance"}, 100)
end
Walker.Start()

elseif (labelName == "deposit") then
Walker.Stop()
Self.ReachDepot(10)
Self.DepositItems({5879,1}, {5880,1}, {10313,1}, {10282,1}, {10309,1}, {10310,1}, {9694,1}, {3032,1}, {3029,1}, {9632,1}, {3061,1})
Self.DepositItems({3392,0}, {10390,0}, {3079,0}, {8052,0}, {8074,0}, {7386,0}, {3381,0}, {811,0}, {812,0}, {3315,0}, {7456,0}, {3436,0}, {3428,0}, {3371,0}, {3369,0}, {3370,0}, {7413,0}, {9302,0}, {3055,0}, {828,0}, {814,0}, {3081,0}, {3051,0}, {3053,0})
Walker.Start()

elseif (labelName == "shop") then
Walker.Stop()
if (Self.ItemCount(238) < MaxMana) or (Self.ItemCount(3155) < MaxSD) then
Self.SayToNpc({"hi", "trade"}, 65)
wait(2000)
if (Self.ItemCount(238) < MaxMana) then
BuyItems(238, MaxMana)
wait(500)
BuyItems(238, MaxMana)
wait(500)
end
if (Self.ItemCount(3155) < MaxSD) then
BuyItems(3155, MaxSD)
wait(500)
BuyItems(3155, MaxSD)
wait(500)
end
wait(200, 500)
end
Walker.Start()

elseif (labelName == "verify") then
Walker.ConditionalGoto((Self.ItemCount(238) >= MaxMana) or (Self.ItemCount(3155) >= MaxSD), "shopOk", "goShop")

elseif (labelName == "resetbp") then -- Reset backpacks
Walker.Stop()
Container.Close(GoldBP)
wait(500)
Container.GetFirst():OpenChildren({GoldBP, true})
if (HideEquipment) then
Client.HideEquipment()
wait(1000)
end
Walker.Start()
end
end
-----------------------------------------------------------------------------
--------------------------------- Functions ---------------------------------
-----------------------------------------------------------------------------

Self.ReachDepot = function (tries)
local tries = tries or 3
Walker.Stop()
local DepotIDs = {3497, 3498, 3499, 3500}
local DepotPos = {}
for i = 1, #DepotIDs do
local dps = Map.GetUseItems(DepotIDs[i])
for j = 1, #dps do
table.insert(DepotPos, dps[j])
end
end
local function gotoDepot()
local pos = Self.Position()
print("Depots found: " .. tostring(#DepotPos))
for i = 1, #DepotPos do
location = DepotPos[i]
Self.UseItemFromGround(location.x, location.y, location.z)
wait(1000, 2000)
if Self.DistanceFromPosition(pos.x, pos.y, pos.z) >= 1 then
wait(5000, 6000)
if Self.DistanceFromPosition(location.x, location.y, location.z) == 1 then
Walker.Start()
return true
end
else
print("Something is blocking the path. Trying next depot.")
end
end
return false
end
repeat
reachedDP = gotoDepot()
if reachedDP then
return true
end
tries = tries - 1
sleep(100)
print("Attempt to reach depot was unsuccessfull. " .. tries .. " tries left.")
until tries <= 0

return false
end

Map.GetUseItems = function (id)
if type(id) == "string" then
id = Item.GetID(id)
end
local pos = Self.Position()
local store = {}
for x = -7, 7 do
for y = -5, 5 do
if Map.GetTopUseItem(pos.x + x, pos.y + y, pos.z).id == id then
itemPos = {x = pos.x + x, y = pos.y + y, z = pos.z}
table.insert(store, itemPos)
end
end
end
return store
end

function BuyItems(item, count) -- item = item id, count = how many you want to buy up to
wait(900, 1200)
if (Self.ItemCount(item) < count) then
Self.ShopBuyItem(item, (count-Self.ItemCount(item)))
wait(200, 500)
end
end

xux
07-15-2013, 01:43 PM
what i saw at first was the double if at start make it 1 if and the other elseif

DarkRoses
07-15-2013, 01:48 PM
what i saw at first was the double if at start make it 1 if and the other elseif

Lol, how did I not see that:( Thanks alot tho<3

xux
07-15-2013, 03:36 PM
Np mate, glad i could help :)