PDA

View Full Version : Help with my .lua file (newb)



Rhinocort
08-13-2012, 08:34 AM
Hey, I get this error message.


10:19 XenoScript Error:
Script: Smuggler Pit Version 1.lua
Line #: 55
Chunk: C:\Users\Michael\Documents\XenoBot\Scripts\Smuggle r Pit Version 1.lua
Error: '<eof>' expected near 'end'
This is an error with user-input and should not be reported as a bug with XenoBot.

The .lua is:


-- Smuggler Pit Version 1 by Rhinocort --
--===========##[CONFIGURATION]##===========--

local MinCap = 10 -- Cap to deposit on.
local MinMana = 5 -- Manas to deposit on.

local MaxMana = 10 -- Amount of manas to buy.

local ManaId = 268 -- Id of Mana Potion.
local ManaPrice = 50 -- How much Mana Potions cost.

local GoldBP = 2872 -- Id of Gold Backpack

local RareDP = 0 -- BP in DP to put Non-Stackable Items Into
local StackDP = 1 -- BP in DP to put Stackable Items Into
-- (0 = first backpack, 1 = second and so on...) --

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

print("Smuggler Pit version 1 \nby Rhinocort")
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName)
if (labelName == "ManaCap") then
print("Current Manas: " .. Self.ItemCount(268))
if (Self.Cap() > MinCap and Self.ItemCount(ManaId) > MinMana) then
gotoLabel("Start")
end

elseif (labelName == "Bank") then
local amount = (MaxMana-Self.ItemCount(ManaId))*ManaPrice
delayWalker(2000)
setWalkerEnabled(false)
Self.SayToNpc({"hi", "deposit all", "yes"}, 65)
if (amount > 0) then
Self.SayToNpc({"withdraw " .. amount, "yes", "balance"}, 65)
end
setWalkerEnabled(true)
elseif (labelName == "BuyManas") then
local manaCount = (MaxMana-Self.ItemCount(ManaId))
delayWalker(2000)
setWalkerEnabled(false)
Self.SayToNpc({"hi", "vials", "yes", "trade"}, 65)
wait(2000, 3700)
while (Self.ItemCount(ManaId) < MaxMana) do
Self.ShopBuyItem(ManaId, manaCount)
wait(200, 500)
end
elseif (labelName == "DepositAll") then
delayWalker(2000)
setWalkerEnabled(false)
Self.SayToNpc({"hi", "deposit all", "yes", "balance"}, 65)
end
end
end

This is my first attempt at making a 100% afk script, so I am still learning. I copied a few things from other .lua files(Infernal Bolt) I had and tried to glue all together, probally messed up somewhere.

Help would be awsome!

(I expect it to be an 'end' too much, or too few)

Tnx

Crown Royal
08-13-2012, 09:00 AM
This fixed the error, there was 1 too many ends, and in the wrong spot. Also, for a continuous script running, you need to add a 'wait' at the end, as I have here :)


-- Smuggler Pit Version 1 by Rhinocort --
--===========##[CONFIGURATION]##===========--
local MinCap = 10 -- Cap to deposit on.
local MinMana = 5 -- Manas to deposit on.

local MaxMana = 10 -- Amount of manas to buy.

local ManaId = 268 -- Id of Mana Potion.
local ManaPrice = 50 -- How much Mana Potions cost.

local GoldBP = 2872 -- Id of Gold Backpack

local RareDP = 0 -- BP in DP to put Non-Stackable Items Into
local StackDP = 1 -- BP in DP to put Stackable Items Into
-- (0 = first backpack, 1 = second and so on...) --
--- DON'T CHANGE ANYTHING BELOW THIS LINE ---

print("Smuggler Pit version 1 \nby Rhinocort")
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "ManaCap") then
print("Current Manas: " .. Self.ItemCount(268))
if (Self.Cap() > MinCap and Self.ItemCount(ManaId) > MinMana) then
gotoLabel("Start")
end
elseif (labelName == "Bank") then
local amount = (MaxMana-Self.ItemCount(ManaId))*ManaPrice
delayWalker(2000)
setWalkerEnabled(false)
Self.SayToNpc({"hi", "deposit all", "yes"}, 65)
if (amount > 0) then
Self.SayToNpc({"withdraw " .. amount, "yes", "balance"}, 65)
end
setWalkerEnabled(true)
elseif (labelName == "BuyManas") then
local manaCount = (MaxMana-Self.ItemCount(ManaId))
delayWalker(2000)
setWalkerEnabled(false)
Self.SayToNpc({"hi", "vials", "yes", "trade"}, 65)
wait(2000, 3700)
while (Self.ItemCount(ManaId) < MaxMana) do
Self.ShopBuyItem(ManaId, manaCount)
wait(200, 500)
end
elseif (labelName == "DepositAll") then
delayWalker(2000)
setWalkerEnabled(false)
Self.SayToNpc({"hi", "deposit all", "yes", "balance"}, 65)
end
wait(300,700)
end

Rhinocort
08-13-2012, 09:03 AM
Perfect, tnx!

Edit: My .lua works now. But at the selected labelnames, it does not talk to npc, does not buy, sell or do anything.

Edit2: Nevermind, fixed it. This newb forgot to actually execute the .lua..

Topic closed