Hello.
You can use Alerts->Item on Screen->Enable Cavebot.
Enable Cavebot: If cavebot IS DISABLED, this will enable and go to label "alert_itemonscreen". If label not found, it will go to first waypoint.
The deal is that if you don't disable runemaker, it may walk back. So this script will disable runemaker and try to reach the location.
If the location IS NOT ON SCREEN then you MUST use the second script, which will use cavebot by using gotolabel() and enabling cavebot.
local DANGER_LOCATION = { X = 12345, Y = 12345, Z = 6 }
local ITEMS_ID = { 1234, 5678, 0123 } -- Items that trigger.
local player_z = posz()
local tiles = gettiles()
local FOUND_ITEM = false
for _, tile in ipairs(tiles) do
if player_z == tile.posz and tile.itemcount > 1 then
for __, item in ipairs(tile.items) do
if table.find(ITEMS_ID, item.id) ~= nil then
FOUND_ITEM = true
break
end
end
end
if FOUND_ITEM then
break
end
end
if FOUND_ITEM then
setsettings('Runemaker/Enabled', false)
reachlocation(DANGER_LOCATION.X, DANGER_LOCATION.Y, DANGER_LOCATION.Z, true)
end
local ITEMS_ID = { 1234, 5678, 0123 } -- Items that trigger.
local CAVEBOT_WPT_LABEL = 'item_found'
local player_z = posz()
local tiles = gettiles()
local FOUND_ITEM = false
for _, tile in ipairs(tiles) do
if player_z == tile.posz and tile.itemcount > 1 then
for __, item in ipairs(tile.items) do
if table.find(ITEMS_ID, item.id) ~= nil then
FOUND_ITEM = true
break
end
end
end
if FOUND_ITEM then
break
end
end
if FOUND_ITEM then
setsettings('Runemaker/Enabled', false)
gotolabel(CAVEBOT_WPT_LABEL)
setsettings('Cavebot/Enabld', true)
end