PDA

View Full Version : Help with this Script



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.

HolmaN
09-21-2012, 10:23 PM
use [CODE] tags. :)

HolmaN
09-21-2012, 10:28 PM
I belive you're missing a space after or just before (self.cap

Writing from my phone at .

Jah
09-21-2012, 10:33 PM
I belive you're missing a space after or just before (self.cap

Writing from my phone at .

And i believe HolmaN is right.
I think it's before.


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

Hypno
09-21-2012, 10:49 PM
Alright, thanks alot! Will try it out tomorrow! :D

Hypno
09-23-2012, 01:37 AM
Didnt work... Seems like no cap checker works for me.... I cant get any of them to work but all the other scripts that has been made by others is working... Could some1 provide me with a working script for a cap checker?

Hypno
09-23-2012, 09:47 AM
Yeap, that was only to see if it jumped to the start again or the leavecave label but it just sorta "ignored" that label and just went for the leavecave label

Infernal Bolt
09-23-2012, 09:49 AM
either do what rydan said or do it this way.



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 and Self.Cap() > MinCap) then
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