PDA

View Full Version : Error lua. Help please



deonsosa
03-09-2013, 04:40 AM
Well I decided to start my first script. and everything was going good till I tried to run my script xd.
when I tried to run it i received this error

22:38 XenoScript Error:
Script: Hive 1.0.lua
Line #: 78
Chunk: C:\Users\Jorge E\Documents\XenoBot\Scripts\Hive 1.0.lua
Error: 'end' expected (to close 'function' at line 35) near '<eof>'
This is an error with user-input and should not be reported as a bug with XenoBot.

Here is my lua script


--[[

The Hive 1.0 / Last updated:
Version 1.0

]]

--------- BP SETUP ----------
-- [BP 1] - Main
-- [BP 2] - Products
-- [BP 3] - Rares
-- [BP 4] - Gold

--------- DP SETUP ----------
-- [DP 1] - Products
-- [DP 2] - Rares

------ REFILL SETTINGS ------
local MinMana = 100 --- How many mana potions until you leave the hunt.
local MaxMana = 600 --- How many mana potions you begin the hunt with.
local MinHealth = 20 --- How many health potions until you leave the hunt.
local MaxHealth = 50 --- How many health potions you begin the hunt with.

--------- HUNT SETTINGS ---------
local GoldBP = 8860 --- Item ID of your gold backpack.
local MinCap = 100 --- Leaves spawn when character reaches this cap.

--------- EXTRA SETTINGS --------
local LogoutStamina = true --- Do you want to logout at 16 hours? (Inside the depot)

--- DON'T CHANGE ANYTHING BELOW THIS LINE ---

registerEventListener(WALKER_SELECTLABEL, "SelectLabel")

function SelectLabel(Label)
if (Label == "checkPotions") then
if (Self.Cap() > MinCap and Self.ItemCount(ManaId) > MinMana) then
gotoLabel("Hunt")
end
elseif (Label == "checkPotions2") then
print("Current Manas: " .. Self.ItemCount(ManaId) .. " / " .. MaxMana)
if (Self.ItemCount(ManaId) < MaxMana) then
gotoLabel("Bank")
end
elseif (Label == "depositGold") then
local amount = (MaxMana-Self.ItemCount(ManaId))*ManaPrice
setWalkerEnabled(false)
Self.SayToNpc({"hi", "deposit all", "yes"}, 65)
if (amount > 0) then
Self.SayToNpc({"withdraw " .. amount, "yes", "balance"}, 65)
end
elseif (Label == "buyManas") then
setWalkerEnabled(false)
Self.SayToNpc({"hi", "vial", "yes", "magic"}, 65)
wait(2000, 3700)
if (Self.ItemCount(ManaId) < MaxMana) then
Self.ShopBuyItemsUpTo(ManaId, MaxMana)
end
setWalkerEnabled(true)
if (labelName == "depot") then
Walker.Stop()
Self.DepositItems({14083, 0}, {14225, 0}, {3010, 0}, {14080, 0}, {14081, 0}, {238, 0}, {14076, 0}, {3027, 0}, {14079, 0}, {9057, 0}, {3032, 0})
Self.DepositItems({3279, 1}, {8084, 1}, {14087, 1}, {14089, 1}, {3326, 1}, {14088, 1})
if (LogoutStamina) and (Self.Stamina() < 960) then
Walker.Stop()
else
Walker.Start()
end
elseif (labelName == "resetbp") then
Walker.Stop()
Container.Close(GoldBP)
wait(1000)
Container.GetFirst():OpenChildren(GoldBP)
wait(1000)
Container.GetByName(GoldBP):Minimize()
Walker.Start()
end
end

Hope some one can help me thank you !

Bastiat
03-09-2013, 07:36 AM
Well I decided to start my first script. and everything was going good till I tried to run my script xd.
when I tried to run it i received this error

22:38 XenoScript Error:
Script: Hive 1.0.lua
Line #: 78
Chunk: C:\Users\Jorge E\Documents\XenoBot\Scripts\Hive 1.0.lua
Error: 'end' expected (to close 'function' at line 35) near '<eof>'
This is an error with user-input and should not be reported as a bug with XenoBot.
Here try this I fixed a few things and cleaned up:

------ REFILL SETTINGS ------
local MinMana = 100 --- How many mana potions until you leave the hunt.
local MaxMana = 600 --- How many mana potions you begin the hunt with.
local MinHealth = 20 --- How many health potions until you leave the hunt.
local MaxHealth = 50 --- How many health potions you begin the hunt with.

--------- HUNT SETTINGS ---------
local GoldBP = 8860 --- Item ID of your gold backpack.
local MinCap = 100 --- Leaves spawn when character reaches this cap.

--------- EXTRA SETTINGS --------
LogoutStamina = true --- Do you want to logout at 16 hours? (Inside the depot)

--- DON'T CHANGE ANYTHING BELOW THIS LINE ---

registerEventListener(WALKER_SELECTLABEL, "SelectLabel")
function SelectLabel(Label)
---------------------------------------------------------------------------
if (Label == "checkPotions") then
if (Self.Cap() > MinCap and Self.ItemCount(ManaId) > MinMana) then
gotoLabel("Hunt")
end
---------------------------------------------------------------------------
elseif (Label == "checkPotions2") then
if (Self.ItemCount(ManaId) < MaxMana) then
gotoLabel("Bank")
end
print("Current Manas: " .. Self.ItemCount(ManaId) .. " / " .. MaxMana)
---------------------------------------------------------------------------
elseif (Label == "depositGold") then
local amount = (MaxMana-Self.ItemCount(ManaId))*ManaPrice
setWalkerEnabled(false)
Self.SayToNpc({"hi", "deposit all", "yes"}, 65)
wait(1000, 2000)
if (amount > 0) then
Self.SayToNpc({"withdraw " .. amount, "yes", "balance"}, 65)
wait(1500, 3000)
end
setWalkerEnabled(true)
---------------------------------------------------------------------------
elseif (Label == "buyManas") then
setWalkerEnabled(false)
Self.SayToNpc({"hi", "vial", "yes", "magic"}, 65)
if (Self.ItemCount(ManaId) < MaxMana) then
wait(1500, 3000)
Self.ShopBuyItemsUpTo(ManaId, MaxMana)
end
wait(1000, 2000)
setWalkerEnabled(true)
---------------------------------------------------------------------------
elseif (Label == "depot") then
Self.DepositItems(
14083,
14225,
3010,
14080,
14081,
238,
14076,
3027,
14079,
9057,
3032,
{3279, 1},
{8084, 1},
{14087, 1},
{14089, 1},
{3326, 1},
{14088, 1}
)
if (LogoutStamina and Self.Stamina() < 960) then
setBotEnabledfalse()
end
---------------------------------------------------------------------------
elseif (Label == "resetbp") then
setWalkerEnabledfalse()
Container.Close(GoldBP)
wait(500, 1000)
Container.GetFirst():OpenChildren(GoldBP)
wait(300, 600)
Container.Minimize(GoldBP)
wait(400, 800)
setWalkerEnabledtrue()
end
end

deonsosa
03-09-2013, 10:46 PM
Here try this I fixed a few things and cleaned up:
thxs man but. now the script actually runs. but the depositer doesnt work. it just jups the label.

Bastiat
03-10-2013, 03:08 AM
thxs man but. now the script actually runs. but the depositer doesnt work. it just jups the label.
I edited the script; changed "labelName" for "Label" for the depositer and backpack-reset, it should work now. Try it again, and make sure you have correct labels in the walker.