Log in

View Full Version : Having issues with a self made script



wannabe
08-31-2015, 03:36 PM
Hello everyone!
I've just !recently! started coding in LUA, I've already hit a few speedbumps.
I've looked on other scripts and try to something like it, I keep getting bugs can someone maybe try to correct this for me?
Thank you very much in advance.

MPotID = 238 --- mana potion ID
MinMPots = 50 ---- if less then script will exit spawn
MPots = 400 ----- amount to refill
MPotprice = 120 ---- price of 1 single mana potion

MinCap = 300 ---- if less then script will exit spawn
if (labelName == "Checker") then
delayWalker(1000)
setWalkerEnabled(false)
if (Self.ItemCount(MPotID) <= MinMPots) or (Self.Cap() <= MinCap) then
setWalkerEnabled(true)
print("Leaving to resupply")
gotoLabel("Resuply")
else
setWalkerEnabled(true)
gotoLabel("Magiclevel")
end

if (labelname == "Potions") then
delaywalker(1000)
setWalkerEnabled(false)
wait(900, 1200)
Self.SayToNpc({"hi", "Trade"}, 65)
wait(900, 1200)
Self.ShopBuyItem(MPotID, (MPots-Self.ItemCount(MPotID)))
wait(200, 500)
setWalkerEnabled(true)
end
end