Untrash SQM
Untrash anything on sqm.
This script will save the items it finds on first run then it will move any other items it finds on further executions.
keywords: untrash location, untrash location, remove trash sqm
Untrash anything on sqm.
local LOCATION = { X = 12345, Y = 12345, Z = 5 } -- Location that you want to untrash.
local MOVE_CREATURES = false
if posz() == LOCATION.Z then
local tile = gettile(LOCATION.X, LOCATION.Y, LOCATION.Z)
if tile.itemcount > 1 then
for _, item_tile in ipairs(tile.items) do
if item_tile.id > 99 then
local notMoveable = itemhasflags(item_tile.id, 13)
if notMoveable and itemhasflags(item_tile.id, 11) == false then
printerror('Found item ' .. item_tile.id .. ' on location, but cannot move it.')
playsound('default')
flashclient()
elseif notMoveable == false then
if reachlocation(LOCATION.X, LOCATION.Y, LOCATION.Z) then
local move_item_sqm = wheretomoveitem(LOCATION.X, LOCATION.Y, LOCATION.Z, true, 2)
if move_item_sqm.posx > 0 then
moveitems(item_tile.id, ground(move_item_sqm.posx, move_item_sqm.posy, move_item_sqm.posz), ground(LOCATION.X, LOCATION.Y, LOCATION.Z), 100)
wait(300, 500)
end
end
end
elseif MOVE_CREATURES then
local move_item_sqm = wheretomoveitem(LOCATION.X, LOCATION.Y, LOCATION.Z, true, 1)
if move_item_sqm.posx > 0 then
moveitems(item_tile.id, ground(move_item_sqm.posx, move_item_sqm.posy, move_item_sqm.posz), ground(LOCATION.X, LOCATION.Y, LOCATION.Z), 100)
wait(300, 500)
end
end
end
end
end
This script will save the items it finds on first run then it will move any other items it finds on further executions.
local LOCATION = { X = 12345, Y = 12345, Z = 5 } -- Location that you want to untrash.
local MOVE_CREATURES = false
if (posx() ~= LOCATION.X or posy() ~= LOCATION.Y) and posz() == LOCATION.Z then
local tile = gettile(LOCATION.X, LOCATION.Y, LOCATION.Z)
if CACHED_TILE_ITEMS == nil then
CACHED_TILE_ITEMS = tile.items
else
if tile.itemcount > 1 then
for _, item_tile in ipairs(tile.items) do
local found_item = false
for __, item_cached in ipairs(CACHED_TILE_ITEMS) do
if item_cached.id == item_tile.id then
found_item = true
break
end
end
if found_item == false and item_tile.id > 99 then
if itemhasflags(item_tile.id, 13) then
printerror('Found item ' .. item_tile.id .. ' on location, but cannot move it.')
playsound('default')
flashclient()
else
if reachlocation(LOCATION.X, LOCATION.Y, LOCATION.Z) then
local move_item_sqm = wheretomoveitem(LOCATION.X, LOCATION.Y, LOCATION.Z, true, 2)
if move_item_sqm.posx > 0 then
moveitems(item_tile.id, ground(move_item_sqm.posx, move_item_sqm.posy, move_item_sqm.posz), ground(LOCATION.X, LOCATION.Y, LOCATION.Z), 100)
wait(300, 500)
end
end
end
elseif item_tile.id == 99 then
local move_item_sqm = wheretomoveitem(LOCATION.X, LOCATION.Y, LOCATION.Z, true, 1)
if move_item_sqm.posx > 0 then
moveitems(item_tile.id, ground(move_item_sqm.posx, move_item_sqm.posy, move_item_sqm.posz), ground(LOCATION.X, LOCATION.Y, LOCATION.Z), 100)
wait(300, 500)
end
end
end
end
end
end
keywords: untrash location, untrash location, remove trash sqm