Log in

View Full Version : 10:58 [XenoScript] fenrock rp.lua: 'end' expected (to close 'function' at line 12) ne



Joe
06-26-2012, 09:05 AM
Can somebody help me out?[
10:58 [XenoScript] fenrock rp.lua: 'end' expected (to close 'function' at line 12) near 'elseif'
File:
ATTACH]2461[/ATTACH]

Jakob Miller
06-26-2012, 09:09 AM
function onWalkerSelectLabel(labelName)

if (labelName == "check") then
delayWalker(1000)
setWalkerEnabled(false)
if (Self.ItemCount(7378) <= 10) then
setWalkerEnabled(true)
gotoLabel("refill")
else
setWalkerEnabled(true)
gotoLabel("KeepHunting")
end
end

Joe
06-26-2012, 09:12 AM
Altho I changed it I still get this error.

Spectrus
06-26-2012, 09:15 AM
Things are so much clearer when you tab them out properly.


function onWalkerSelectLabel(labelName)
if (labelName == "check") then
delayWalker(1000)
setWalkerEnabled(false)
if (Self.ItemCount(7378) <= 10) then
setWalkerEnabled(true)
gotoLabel("refill")
else
setWalkerEnabled(true)
gotoLabel("KeepHunting")
end
end
end


EDIT: Hai floppy.

Flappy Joe
06-26-2012, 09:15 AM
It should be


function onWalkerSelectLabel(labelName)

if (labelName == "check") then
delayWalker(1000)
setWalkerEnabled(false)
if (Self.ItemCount(7378) <= 10) then
setWalkerEnabled(true)
gotoLabel("refill")
else
setWalkerEnabled(true)
gotoLabel("KeepHunting")
end
end
end


If that's wrong, idk where the end goes.

Joe
06-26-2012, 09:19 AM
Still same thing goes wrong ;(

Jakob Miller
06-26-2012, 09:20 AM
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")


function NpcConv(...)
for _, str in ipairs(arg) do
wait((tostring(str):len() / 125) * 60000 * math.random(1.1, 1.8))
Self.SayToNpc(str)
end
end
dofile("Forgee.lua")
function onWalkerSelectLabel(labelName)

if (labelName == "check") then
delayWalker(1000)
setWalkerEnabled(false)
if (Self.ItemCount(7378) <= 10) then
setWalkerEnabled(true)
gotoLabel("refill")
else
setWalkerEnabled(true)
gotoLabel("KeepHunting")
end
elseif (labelName == "Deposit") then
setWalkerEnabled(false)
Self.DepositItems({3071, 1},{3556, 1}, {10279, 1}, {5899, 1}, {7430, 1}, {3061, 2}, {5922, 2},{11457, 2}, {5920, 2}, {3073, 1}, {11465, 2}, {9635, 2}, {3028, 2}, {5877, 2}, {3037, 1})
wait(1500,1900)
setWalkerEnabled(true)

elseif (labelName == "Bank") then
setWalkerEnabled(false)
NpcConv("hi","deposit all","yes","balance")
wait(900, 1200)
Self.WithdrawMoney((15*(32-Self.ItemCount(7378))))
wait(900, 1200)
Self.SayToNpc("yes")
wait(15000,19000)
setWalkerEnabled(true)
elseif (labelName == "buyrs") then
setWalkerEnabled(false)
Self.SayToNpc({"Hi", "Trade"}, 65)
wait(900, 1200)
buyAlotOfItemsBecauseItsSuchAGodDamnBigDeal(7378, (25-Self.ItemCount(7378)))
wait(200, 500)
setWalkerEnabled(true)
elseif (labelName == "fenrock") then
setWalkerEnabled(false)
wait(900, 1200)
Self.SayToNpc({"Hi", "fenrock", "yes"}, 65)
wait(900, 1200)
setWalkerEnabled(true)

elseif (labelName == "yalahar") then
setWalkerEnabled(false)
wait(900, 1200)
Self.SayToNpc({"Hi", "yalahar", "yes"}, 65)
wait(900, 1200)
setWalkerEnabled(true)

elseif (labelName == "backpacks") then
setWalkerEnabled(false)
resetBackpacks()
wait(1500,1900)
setWalkerEnabled(true)
end
end
function buyAlotOfItemsBecauseItsSuchAGodDamnBigDeal(item, count)
count = tonumber(count) or 1
repeat
local amnt = math.min(count, 100)
if(Self.ShopBuyItem(item, amnt) == 0)then
return printf("ERROR: failed to buy item: %s", tostring(item))
end
wait(200,500)
count = (count - amnt)
until count <= 0
end


Copy Paste this entire code. Were a lot of ends that were on wrong location.

Joe
06-26-2012, 09:22 AM
Now it works. Thank buy guys for your support. I need to learn much more about lua. lol

Jakob Miller
06-26-2012, 09:23 AM
Now it works. Thank buy guys for your support. I need to learn much more about lua. lol

Use Notepad++. Helps a lot to see if the functions are ended or not!

Johanz1337
07-06-2012, 08:46 AM
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")


function NpcConv(...)
for _, str in ipairs(arg) do
wait((tostring(str):len() / 125) * 60000 * math.random(1.1, 1.8))
Self.SayToNpc(str)
end
end
dofile("Forgee.lua")
function onWalkerSelectLabel(labelName)

if (labelName == "check") then
delayWalker(1000)
setWalkerEnabled(false)
if (Self.ItemCount(7378) <= 10) then
setWalkerEnabled(true)
gotoLabel("refill")
else
setWalkerEnabled(true)
gotoLabel("KeepHunting")
end
elseif (labelName == "Deposit") then
setWalkerEnabled(false)
Self.DepositItems({3071, 1},{3556, 1}, {10279, 1}, {5899, 1}, {7430, 1}, {3061, 2}, {5922, 2},{11457, 2}, {5920, 2}, {3073, 1}, {11465, 2}, {9635, 2}, {3028, 2}, {5877, 2}, {3037, 1})
wait(1500,1900)
setWalkerEnabled(true)

elseif (labelName == "Bank") then
setWalkerEnabled(false)
NpcConv("hi","deposit all","yes","balance")
wait(900, 1200)
Self.WithdrawMoney((15*(32-Self.ItemCount(7378))))
wait(900, 1200)
Self.SayToNpc("yes")
wait(15000,19000)
setWalkerEnabled(true)
elseif (labelName == "buyrs") then
setWalkerEnabled(false)
Self.SayToNpc({"Hi", "Trade"}, 65)
wait(900, 1200)
buyAlotOfItemsBecauseItsSuchAGodDamnBigDeal(7378, (25-Self.ItemCount(7378)))
wait(200, 500)
setWalkerEnabled(true)
elseif (labelName == "fenrock") then
setWalkerEnabled(false)
wait(900, 1200)
Self.SayToNpc({"Hi", "fenrock", "yes"}, 65)
wait(900, 1200)
setWalkerEnabled(true)

elseif (labelName == "yalahar") then
setWalkerEnabled(false)
wait(900, 1200)
Self.SayToNpc({"Hi", "yalahar", "yes"}, 65)
wait(900, 1200)
setWalkerEnabled(true)

elseif (labelName == "backpacks") then
setWalkerEnabled(false)
resetBackpacks()
wait(1500,1900)
setWalkerEnabled(true)
end
end
function buyAlotOfItemsBecauseItsSuchAGodDamnBigDeal(item, count)
count = tonumber(count) or 1
repeat
local amnt = math.min(count, 100)
if(Self.ShopBuyItem(item, amnt) == 0)then
return printf("ERROR: failed to buy item: %s", tostring(item))
end
wait(200,500)
count = (count - amnt)
until count <= 0
end


Copy Paste this entire code. Were a lot of ends that were on wrong location.

10:46 [XenoScript] fenrock rp.lua: 'end' expected (to close 'for' at line 6) near '<eof>'

That appears when I copied your code. :s

Jakob Miller
07-06-2012, 01:15 PM
YOu need two end after the label checker part. Might also need one more at the of the entire code. Can't check this myself, typing from my phone.