PDA

View Full Version : help ([XenoScript] Rook chain armor.lua: unexpected symbol near 'then')



desche188
06-16-2012, 12:59 PM
[XenoScript] Rook chain armor.lua: unexpected symbol near 'then'


-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

MPotID = 7876 --- mana potion ID
MinMPots = 10 ---- if less then script will exit spawn
MPots = 20 ----- amount to refill
MPotprice = 50 ---- price of 1 single mana pot

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName)
if (labelName == "Checker") then
if (Self.Cap() < MinCap) or ((Self.ItemCount(MPotID) < MinMPots)) then<- this one
gotoLabelz(Leave)
else
gotoLabel('Keep Hunting')
end

elseif (labelName == "Sell") then
delayWalker(5000)
Self.Say("hi")
sleep(math.random(700, 1400))
Self.ShopSellItem(item, sell)
sleep(math.random(700, 1400))
end
end

elseif (labelName == "potions") then
setWalkerEnabled(false)
wait(900, 1200)
Self.ShopSellItem(285, sell)
wait(900, 1200)
buyAlotOfItemsBecauseItsSuchAGodDamnBigDeal(MPotID , (MPots-Self.ItemCount(MPotID)))
wait(900, 1200)
setWalkerEnabled(true)
end
end

FrogWT
06-16-2012, 01:05 PM
[XenoScript] Rook chain armor.lua: unexpected symbol near 'then'


-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

MPotID = 7876 --- mana potion ID
MinMPots = 10 ---- if less then script will exit spawn
MPots = 20 ----- amount to refill
MPotprice = 50 ---- price of 1 single mana pot

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName)
if (labelName == "Checker") then
if (Self.Cap() < MinCap) or ((Self.ItemCount(MPotID) < MinMPots)) then<- this one
gotoLabelz(Leave)
else
gotoLabel('Keep Hunting')
end

elseif (labelName == "Sell") then
delayWalker(5000)
Self.Say("hi")
sleep(math.random(700, 1400))
Self.ShopSellItem(item, sell)
sleep(math.random(700, 1400))
end
end

elseif (labelName == "potions") then
setWalkerEnabled(false)
wait(900, 1200)
Self.ShopSellItem(285, sell)
wait(900, 1200)
buyAlotOfItemsBecauseItsSuchAGodDamnBigDeal(MPotID , (MPots-Self.ItemCount(MPotID)))
wait(900, 1200)
setWalkerEnabled(true)
end
end


if (Self.Cap() < MinCap) or (Self.ItemCount(MPotID) < MinMPots) then
gotoLabel('Leave')


Try it.

desche188
06-16-2012, 02:53 PM
if (Self.Cap() < MinCap) or (Self.ItemCount(MPotID) < MinMPots) then
gotoLabel('Leave')


Try it.


did not work [XenoScript] Rook chain armor.lua: unexpected symbol near 'then'

function onWalkerSelectLabel(labelName)
if (labelName == "Checker") then
if (Self.Cap() < MinCap) or (Self.ItemCount(MPotID) < MinMPots) then <again did not work
gotoLabel('Leave') then
else
gotoLabel('Keep Hunting')
end

L!p3
06-16-2012, 04:11 PM
did not work [XenoScript] Rook chain armor.lua: unexpected symbol near 'then'

function onWalkerSelectLabel(labelName)
if (labelName == "Checker") then
if (Self.Cap() < MinCap) or (Self.ItemCount(MPotID) < MinMPots) then <again did not work
gotoLabel('Leave') then
else
gotoLabel('Keep Hunting')
end

You should delet the 'then' after gotoLabel('Leave').

If X then
do whatever
else
do whatever
end


function onWalkerSelectLabel(labelName)
if (labelName == "Checker") then
if (Self.Cap() < MinCap) or (Self.ItemCount(MPotID) < MinMPots) then
gotoLabel('Leave')
else
gotoLabel('Keep Hunting')
end
end
end

desche188
06-16-2012, 04:19 PM
You should delet the 'then' after gotoLabel('Leave').

If X then
do whatever
else
do whatever
end


function onWalkerSelectLabel(labelName)
if (labelName == "Checker") then
if (Self.Cap() < MinCap) or (Self.ItemCount(MPotID) < MinMPots) then
gotoLabel('Leave')
else
gotoLabel('Keep Hunting')
end
end
end

I did delete the then but it says unexpected symbol near 'then' can you make a walker thing and test it

L!p3
06-16-2012, 04:40 PM
I've edited the file(.lua) from your first post and It worked here.


-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

MPotID = 7876 --- mana potion ID
MinMPots = 10 ---- if less then script will exit spawn
MPots = 20 ----- amount to refill
MPotprice = 50 ---- price of 1 single mana pot

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName)
if (labelName == "Checker") then
if ((Self.Cap() < MinCap) or (Self.ItemCount(MPotID) < MinMPots)) then
gotoLabel("Leave")
else
gotoLabel("Keep Hunting")
end
elseif (labelName == "Sell") then
delayWalker(5000)
Self.Say("hi")
sleep(math.random(700, 1400))
Self.ShopSellItem(item, sell)
sleep(math.random(700, 1400))
elseif (labelName == "potions") then
setWalkerEnabled(false)
wait(900, 1200)
Self.ShopSellItem(285, sell)
wait(900, 1200)
buyAlotOfItemsBecauseItsSuchAGodDamnBigDeal(MPotID , (MPots-Self.ItemCount(MPotID)))
wait(900, 1200)
setWalkerEnabled(true)
end
end

Check if it works now.

desche188
06-17-2012, 02:55 AM
this thing doesnt buy potions




elseif (labelName == "potions") then
setWalkerEnabled(false)
Self.SayToNpc("hi")
wait(900, 1200)
Self.SayToNpc("trade")
wait(900, 1200)
Self.ShopSellItem(285, 0)
wait(900, 1200)
BuyPots(MPotID, (MPots-Self.ItemCount(MPotID)))
wait(900, 1200)
setWalkerEnabled(true)
end
end

function BuyPots(item, count)
count = tonumber(count) or 1
repeat
local amnt = math.min(count, 10)
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

desche188
06-17-2012, 03:06 AM
I've edited the file(.lua) from your first post and It worked here.


-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

MPotID = 7876 --- mana potion ID
MinMPots = 10 ---- if less then script will exit spawn
MPots = 20 ----- amount to refill
MPotprice = 50 ---- price of 1 single mana pot

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName)
if (labelName == "Checker") then
if ((Self.Cap() < MinCap) or (Self.ItemCount(MPotID) < MinMPots)) then
gotoLabel("Leave")
else
gotoLabel("Keep Hunting")
end
elseif (labelName == "Sell") then
delayWalker(5000)
Self.Say("hi")
sleep(math.random(700, 1400))
Self.ShopSellItem(item, sell)
sleep(math.random(700, 1400))
elseif (labelName == "potions") then
setWalkerEnabled(false)
wait(900, 1200)
Self.ShopSellItem(285, sell)
wait(900, 1200)
buyAlotOfItemsBecauseItsSuchAGodDamnBigDeal(MPotID , (MPots-Self.ItemCount(MPotID)))
wait(900, 1200)
setWalkerEnabled(true)
end
end

Check if it works now.

all of it worked but it doesnt buy potions and i want it to buy potions untill 20

desche188
06-17-2012, 03:44 AM
can anyone help