Log in

View Full Version : Need some help with a Cavebot script!



Ostron
01-27-2012, 06:26 PM
Hello!

I recently downloaded a script for rotworms in liberty bay by a guy here on forum.
And now i try to add a gold depositer to the script, But when i come to "CheckCap" It just goes past it and starts go up to the bank when i still have much cap left.

Here how my cavebot script looks like



<panel name="Walker">
<control name="WaypointList" value="">
<item text="KeepHunting:" tag="255"/>
<item text="Stand (32251, 32802, 10)" tag="1"/>
<item text="Stand (32270, 32796, 10)" tag="1"/>
<item text="Stand (32269, 32780, 10)" tag="1"/>
<item text="Stand (32272, 32739, 10)" tag="1"/>
<item text="Stand (32262, 32732, 10)" tag="1"/>
<item text="Stand (32263, 32709, 10)" tag="1"/>
<item text="Stand (32263, 32689, 10)" tag="1"/>
<item text="Stand (32241, 32709, 10)" tag="1"/>
<item text="Stand (32238, 32734, 10)" tag="1"/>
<item text="Node (32239, 32744, 10)" tag="0"/>
<item text="Stand (32252, 32751, 10)" tag="1"/>
<item text="Stand (32255, 32754, 10)" tag="1"/>
<item text="Stand (32241, 32776, 10)" tag="1"/>
<item text="Stand (32226, 32791, 10)" tag="1"/>
<item text="Stand (32220, 32800, 10)" tag="1"/>
<item text="Stand (32204, 32828, 10)" tag="1"/>
<item text="Stand (32214, 32830, 10)" tag="1"/>
<item text="Stand (32200, 32802, 10)" tag="1"/>
<item text="Stand (32189, 32784, 10)" tag="1"/>
<item text="Stand (32174, 32748, 10)" tag="1"/>
<item text="Stand (32183, 32729, 10)" tag="1"/>
<item text="Stand (32197, 32728, 10)" tag="1"/>
<item text="Stand (32209, 32736, 10)" tag="1"/>
<item text="Stand (32206, 32746, 10)" tag="1"/>
<item text="Stand (32204, 32762, 10)" tag="1"/>
<item text="Stand (32220, 32762, 10)" tag="1"/>
<item text="Stand (32231, 32763, 10)" tag="1"/>
<item text="Stand (32244, 32777, 10)" tag="1"/>
<item text="Stand (32231, 32792, 10)" tag="1"/>
<item text="CheckCap:" tag="255"/>
<item text="DepositGold:" tag="255"/>
<item text="Rope (32251, 32811, 10)" tag="3"/>
<item text="Rope (32238, 32824, 9)" tag="3"/>
<item text="Rope (32225, 32849, 8)" tag="3"/>
<item text="Node (32282, 32842, 7)" tag="0"/>
<item text="Stand (32339, 32836, 7)" tag="1"/>
<item text="AtBank:" tag="255"/>
<item text="ReturnToHunt:" tag="255"/>
<item text="Hole (32226, 32848, 7)" tag="4"/>
<item text="Hole (32238, 32824, 8)" tag="4"/>
<item text="Hole (32250, 32810, 9)" tag="4"/>
</control>
</panel>


And here is how the deposit Gold script looks like,


function onWalkerSelectLabel(labelName)
if (labelName == "CheckCap") then
if (Self.Cap() < 20) then
gotoLabel("DepositGold")
else
gotoLabel("KeepHunting")
end
elseif (labelName == "AtBank") then
delayWalker(3000) --Call this immediately, before evr sleeping. Walker and scripter are in different threads so if we sleep before calling this walker will proceed a few wps before this bites

Self.Say("Hi")
sleep(math.random(700, 1400)) --Sleep between everything we say. saying everything very quickly can be _highly_ suspicious
Self.SayToNpc("Deposit all")
sleep(math.random(700, 1400))
Self.SayToNpc("Yes")

gotoLabel("ReturnToHunt")
end
end


I attached the script here aswell!
572


I hope someone can help me!

Thanks!

Infernal Bolt
01-28-2012, 08:47 PM
i'd advice you to use the label script syntax released, ill see if i can fix it for you.

Edit comes shortly.

Edit:
Fixed it for you, make 2 lua files and place them into Documents\XenoBot\Scripts name them to "label manger.lua" and "functions.lua".
You only need to execute label manager.lua

Credits to Syntax for Lua scripts.

label manger.lua

--[[
Label Manager
Version 3.0
By Syntax, notes provided by DarkstaR

Notes:

To plug this into any script, set the cap limit and structure your waypoints like so:
KeepHunting:
walk
through
cave
checkCap(limit):
GotoBank:
walk
to
bank
depositGold():
ReturnToHunt:
walk
back
to
hunt
]]

local DebugMode = false -- enable this if you want labels that do not have functions assigned to them to show a message when they are selected
dofile("functions.lua")
displayInformationMessage("Function labels are now enabled in the walker!")
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
local func = loadstring(labelName)
if(func)then func() elseif(DebugMode)then
displayInformationMessage("The label '"..labelName.."' does not have an associated function or there was an error!")
end
end

functions.lua

function checkCap(limit)
displayInformationMessage(tostring(limit))
if (Self.Cap() < limit) then
gotoLabel("GotoBank")
else
gotoLabel("KeepHunting")
end
end

function depositGold()
delayWalker(3000) --Call this immediately, before ever sleeping. Walker and scripter are in different threads so if we sleep before calling this walker will proceed a few wps before this bites
Self.Say("Hi")
sleep(math.random(700, 1400)) --Sleep between everything we say. saying everything very quickly can be _highly_ suspicious
Self.SayToNpc("Deposit all")
sleep(math.random(700, 1400))
Self.SayToNpc("Yes")
gotoLabel("ReturnToHunt")
end

function checkHP(limit)
if (Self.Health() < limit) then
gotoLabel("House")
else
delayWalker(math.random(500, 1000))
gotoLabel("Train")
end
end

Ostron
01-29-2012, 09:57 AM
Thanks alot!

RoZpr0
02-01-2012, 11:35 PM
Helped me much to understand how to implement Label's =]

Demer
02-02-2012, 11:41 AM
ello guys i testing your waypoint my character running a way 10-15 sqm than he standing he going 2sqm left 2sqm to right and he no running more any waypoint why that maybe you have added stand?