This script will it eat food directly from ground/floor. It will search for one of the listed foods on the sqms around your character.
There's also an option to untrash it, if there are items on food sqm then it will try to pickup.
There are two scripts in this thread, both of which do the same thing. The only difference is in the UNTRASH option, in the first script it will only pick up the trash to your bp, in the second script it will try to move to another sqm on the floor and if you can't, it will try to get it to your bp.
1st script
On this script, the UNTRASH option will pickup the trash to your bp.
2nd script
On this script, the UNTRASH option will try to move trash to another sqm or pickup the trash to your bp.
There's also an option to untrash it, if there are items on food sqm then it will try to pickup.
There are two scripts in this thread, both of which do the same thing. The only difference is in the UNTRASH option, in the first script it will only pick up the trash to your bp, in the second script it will try to move to another sqm on the floor and if you can't, it will try to get it to your bp.
1st script
On this script, the UNTRASH option will pickup the trash to your bp.
local FOODS = { 3578, 3582, 3577, 3585, 3725 } -- List of food ids.
local EAT_TIME = { Min = 300, Max = 480, } -- In SECONDS. Time to wait after eating food to eat again.
local EAT_TRIES = { Min = 3, Max = 8, } -- How tries to eat
local STOP_FULL = true -- Stop if you are full msg appears.
local UNTRASH = true
NEXT_EAT_TIME = NEXT_EAT_TIME or 1
if connected() and runningtime() >= NEXT_EAT_TIME then
local tiles = gettiles()
local player_x = posx()
local player_y = posy()
local player_z = posz()
local food_location = { id = 0, x = 0, y = 0 }
for _, tile in ipairs(tiles) do
if math.abs(tile.posx - player_x) <= 1 and math.abs(tile.posy - player_y) <= 1 and tile.posz == player_z and tile.itemcount > 1 then
for __, item in ipairs(tile.items) do
if table.find(FOODS, item.id) ~= nil then
food_location.id = item.id
food_location.x = tile.posx
food_location.y = tile.posy
break
end
end
if UNTRASH and food_location.id > 0 then
local top_item = topitem(tile.posx, tile.posy, tile.posz)
while top_item.id > 0 and top_item.id ~= food_location.id and table.find(FOODS, top_item.id) == nil and itemhasflags(top_item.id, 16) do
moveitems(top_item.id, '', ground(tile.posx, tile.posy, tile.posz), 100)
wait(500, 800)
top_item = topitem(tile.posx, tile.posy, tile.posz)
end
end
end
if food_location.x > 0 then
break
end
end
if food_location.x > 0 then
for i = 1, random(EAT_TRIES.Min, EAT_TRIES.Max) do
useitem(food_location.id, ground(food_location.x, food_location.y, player_z))
wait(400, 800)
if STOP_FULL and statusmessage() == 'You are full.' then
break
end
end
NEXT_EAT_TIME = runningtime() + random(EAT_TIME.Min, EAT_TIME.Max)
end
end
2nd script
On this script, the UNTRASH option will try to move trash to another sqm or pickup the trash to your bp.
local FOODS = { 3578, 3582, 3577, 3585, 3725 } -- List of food ids.
local EAT_TIME = { Min = 300, Max = 480, } -- In SECONDS. Time to wait after eating food to eat again.
local EAT_TRIES = { Min = 3, Max = 8, } -- How tries to eat
local STOP_FULL = true -- Stop if you are full msg appears.
local UNTRASH = true
NEXT_EAT_TIME = NEXT_EAT_TIME or 1
if connected() and runningtime() >= NEXT_EAT_TIME then
local tiles = gettiles()
local player_x = posx()
local player_y = posy()
local player_z = posz()
local food_location = { id = 0, x = 0, y = 0 }
for _, tile in ipairs(tiles) do
if math.abs(tile.posx - player_x) <= 1 and math.abs(tile.posy - player_y) <= 1 and tile.posz == player_z and tile.itemcount > 1 then
for __, item in ipairs(tile.items) do
if table.find(FOODS, item.id) ~= nil then
food_location.id = item.id
food_location.x = tile.posx
food_location.y = tile.posy
break
end
end
if UNTRASH and food_location.id > 0 then
local top_item = topitem(tile.posx, tile.posy, tile.posz)
while top_item.id > 0 and top_item.id ~= food_location.id and table.find(FOODS, top_item.id) == nil do
local flag = false
if itemhasflags(top_item.id, 13) == false then
local move_sqm = wheretomoveitem(tile.posx, tile.posy, tile.posz)
if move_sqm.posx > 0 then
flag = true
moveitems(top_item.id, ground(move_sqm.posx, move_sqm.posy, move_sqm.posz), ground(tile.posx, tile.posy, tile.posz), 100)
wait(500, 800)
end
end
if flag == false and itemhasflags(top_item.id, 16) then
moveitems(top_item.id, '', ground(tile.posx, tile.posy, tile.posz), 100)
wait(500, 800)
end
top_item = topitem(tile.posx, tile.posy, tile.posz)
end
end
end
if food_location.x > 0 then
break
end
end
if food_location.x > 0 then
for i = 1, random(EAT_TRIES.Min, EAT_TRIES.Max) do
useitem(food_location.id, ground(food_location.x, food_location.y, player_z))
wait(400, 800)
if STOP_FULL and statusmessage() == 'You are full.' then
break
end
end
NEXT_EAT_TIME = runningtime() + random(EAT_TIME.Min, EAT_TIME.Max)
end
end