PDA

View Full Version : Could someone check this script please?



Dogder
08-16-2012, 03:15 PM
I just downloaded this script. its supposed to refill when i run out of pots, and deposit and so. i open scripter --> find my script ---> click execute --> but then it pops right back to the non executed ones.

MPotID = 268 --- mana potion ID
MinMPots = 40 ---- if less then script will exit spawn
MPots = 250 ----- amount to refill
MPotprice = 50 ---- price of 1 single mana pot
HPotID = 236 ---- health potion ID
HPotprice = 80 ---- health potion price
HPots = 25 ---- health potions you want to buy
MinHPots = 5 ---- min of health potions to leave
MinCap = 100 ---- if less then script will exit spawn
-------------------------------------------------
--END OF SETTINGS--------------------------------



--- DO NOT CHANGE BELOW UNLESS YOU KNOW WHAT YOU'RE DOING ---

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

local info = [[
Free script made by:
Y2Quake]]
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(MPotID) <= MinMPots) or (Self.Cap() < MinCap) or (Self.ItemCount(HPotID) <= MinHPots) then
setWalkerEnabled(true)
gotoLabel("Refill")
else
setWalkerEnabled(true)
gotoLabel("KeepHunting")
end
elseif (labelName == "KeepHunting") then
print(info)
elseif (labelName == "bank") then
setWalkerEnabled(false)
NpcConv("hi","deposit all","yes","balance")
wait(900, 1200)
Self.WithdrawMoney((MPotprice*(MPots-Self.ItemCount(MPotID))))
wait(900, 1200)
Self.SayToNpc("yes")
wait(900, 1200)
Self.WithdrawMoney((HPotprice*(HPots-Self.ItemCount(HPotID))))
wait(900, 1200)
Self.SayToNpc("yes")
wait(15000,19000)
setWalkerEnabled(true)
elseif (labelName == "deposit") then
setWalkerEnabled(false)
local dprandomise = (math.random(1,2))
if ((dprandomise) ~=1) then
Self.DepositItems(3416, 7430, 3071, 3322, 3297, {3028, 1}, {11457, 1}, {5877, 1}, {5920, 1})
wait(1500,1900)
setWalkerEnabled(true)
else
Self.DepositItems(3297, 3322, 3071, 7430, 3416, {5920, 1}, {5877, 1}, {11457, 1}, {3028, 1})
wait(1500,1900)
setWalkerEnabled(true)
end
elseif (labelName == "tradepots") then
setWalkerEnabled(false)
wait(900, 1200)
Self.SayToNpc({"Hi", "flasks", "yes", "yes", "yes", "Trade"}, 65)
wait(900, 1200)
buyAlotOfItemsBecauseItsSuchAGodDamnBigDeal(MPotID , (MPots-Self.ItemCount(MPotID)))
wait(900, 1200)
buyAlotOfItemsBecauseItsSuchAGodDamnBigDeal(HPotID , (HPots-Self.ItemCount(HPotID)))
wait(200, 500)
setWalkerEnabled(true)
elseif (labelName == "backpacks") then
dofile("Forgee.lua")
delayWalker(15000)
resetBackpacks()
elseif (labelName == "check2") then
if (Self.ItemCount(MPotID) <= MinMPots) or (Self.Cap() < MinCap) or (Self.ItemCount(HPotID) <= MinHPots) then
gotoLabel("godp")
else
gotoLabel("gotospawn")
end
elseif(labelName == "stopwalker") then
setWalkerEnabled(false)
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


thanks in advance :)

desche188
08-16-2012, 03:19 PM
do you have forgee.lua in your scripts folder?

Dogder
08-16-2012, 03:48 PM
no i dont, what is it? :)

desche188
08-16-2012, 03:52 PM
no i dont, what is it? :)

http://forums.xenobot.net/showthread.php?2392-Lua-functions-by-Forgee&highlight=forgee.lua

c (http://forums.xenobot.net/showthread.php?2392-Lua-functions-by-Forgee&highlight=forgee.lua)opy and paste the list of 732 functions and save as forgee.lua and place it in scripts folder and your script will work

Dogder
08-16-2012, 03:54 PM
you're awesome man. thanks alot! :D

Xeno Scripts
08-16-2012, 03:54 PM
dofile("Forgee.lua") must be in the beginning of the script (after mana config etc.)

You have it in the middle of the script.

desche188
08-16-2012, 03:55 PM
dofile("Forgee.lua") must be in the beginning of the script (after mana config etc.)

You have it in the middle of the script.

i checked it it will work only prob is he dont have forgee.lua so it will crash

Dogder
08-16-2012, 04:03 PM
i didnt work without the dofile("forgee.lua") in the top of script. but it runs now. thanks alot guys!