Hypno
09-21-2012, 09:59 PM
I really cant figure out how to get this cap checker to work... I got the deposit working and the mana buyer, just cant get the cap/mana checker to work... Would appreciate any help, its at krimhorn (Not my script, just copy pasted a few lua things from other working scripts, worked before so I thought it would work again) Ive given up after trying to fix it for the last 3 hours. Any help would be appreciated.
The label the script starts at is called keephunting, it checks cap/manas at the label check, and the label leave is waypoints to town.
(If some1 could tell me on how to put the code in a scroll thingy instead of copy pasting it, it would be really appreciated!)
dofile("Forgee.lua")
--Settings-------------------------------------------
PotID = 268 --- mana potion ID
MinPots = 50 ---- if less then script will exit spawn
MinCap = 100 ---- if less then script will exit spawn
Pots = 300 ----- amount to refill
-----------------------------------------------------
--END OF SETTINGS------------------------------------
--- DO NOT CHANGE BELOW UNLESS YOU KNOW WHAT YOU'RE DOING ---
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "bank") then
setWalkerEnabled(false)
Self.Say("hi")
wait(900, 1200)
Self.SayToNpc("deposit all")
wait(900, 1200)
Self.SayToNpc("yes")
wait(900, 1200)
Self.SayToNpc("withdraw 200")
wait(900, 1200)
Self.SayToNpc("yes")
wait(900, 1200)
Self.SayToNpc("withdraw " .. ((Pots - Self.ItemCount(PotID)) * 50))
wait(900, 1200)
Self.SayToNpc("yes")
setWalkerEnabled(true)
elseif (labelName == "depot") then
delayWalker(15000)
Self.DepositItems({7462, 1}, {5913, 1}, {7457, 1}, {3052, 1}, {7379, 1}, {5911, 1}, {7449, 1}, {7463, 1}, {7464, 1}, {3344, 1}, {7290, 1}, {7441, 1}, {3574, 1}, {7387, 1}, {7459, 1}, {3067, 1}, {823, 1}, {819, 1})
elseif (labelName == "Backpacks") then
setWalkerEnabled(false)
resetBackpacks()
setWalkerEnabled(true)
elseif (labelName == "check") then
setWalkerEnabled(false)
if (Self.ItemCount(PotID) <= MinPots) or(Self.Cap() < MinCap) then
setWalkerEnabled(true)
gotoLabel("keephunting")
else
setWalkerEnabled(true)
gotoLabel("keephunting")
end
elseif (labelName == "Potions") then
mp = ((Pots - Self.ItemCount(268)))
setWalkerEnabled(false)
wait(900, 1200)
Self.SayToNpc({"Hi", "Trade"}, 65)
wait(900, 1200)
Self.ShopBuyItem(PotID, mp)
wait(200, 500)
setWalkerEnabled(true)
end
end
It looks cleaner before I post it but it changes once I post it, sorry for the "mess"
Bit nooby with forums so please excuse me if this is the wrong "format" to do it.
The label the script starts at is called keephunting, it checks cap/manas at the label check, and the label leave is waypoints to town.
(If some1 could tell me on how to put the code in a scroll thingy instead of copy pasting it, it would be really appreciated!)
dofile("Forgee.lua")
--Settings-------------------------------------------
PotID = 268 --- mana potion ID
MinPots = 50 ---- if less then script will exit spawn
MinCap = 100 ---- if less then script will exit spawn
Pots = 300 ----- amount to refill
-----------------------------------------------------
--END OF SETTINGS------------------------------------
--- DO NOT CHANGE BELOW UNLESS YOU KNOW WHAT YOU'RE DOING ---
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "bank") then
setWalkerEnabled(false)
Self.Say("hi")
wait(900, 1200)
Self.SayToNpc("deposit all")
wait(900, 1200)
Self.SayToNpc("yes")
wait(900, 1200)
Self.SayToNpc("withdraw 200")
wait(900, 1200)
Self.SayToNpc("yes")
wait(900, 1200)
Self.SayToNpc("withdraw " .. ((Pots - Self.ItemCount(PotID)) * 50))
wait(900, 1200)
Self.SayToNpc("yes")
setWalkerEnabled(true)
elseif (labelName == "depot") then
delayWalker(15000)
Self.DepositItems({7462, 1}, {5913, 1}, {7457, 1}, {3052, 1}, {7379, 1}, {5911, 1}, {7449, 1}, {7463, 1}, {7464, 1}, {3344, 1}, {7290, 1}, {7441, 1}, {3574, 1}, {7387, 1}, {7459, 1}, {3067, 1}, {823, 1}, {819, 1})
elseif (labelName == "Backpacks") then
setWalkerEnabled(false)
resetBackpacks()
setWalkerEnabled(true)
elseif (labelName == "check") then
setWalkerEnabled(false)
if (Self.ItemCount(PotID) <= MinPots) or(Self.Cap() < MinCap) then
setWalkerEnabled(true)
gotoLabel("keephunting")
else
setWalkerEnabled(true)
gotoLabel("keephunting")
end
elseif (labelName == "Potions") then
mp = ((Pots - Self.ItemCount(268)))
setWalkerEnabled(false)
wait(900, 1200)
Self.SayToNpc({"Hi", "Trade"}, 65)
wait(900, 1200)
Self.ShopBuyItem(PotID, mp)
wait(200, 500)
setWalkerEnabled(true)
end
end
It looks cleaner before I post it but it changes once I post it, sorry for the "mess"
Bit nooby with forums so please excuse me if this is the wrong "format" to do it.