• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[C++] Get all items on tile

Dubler

PHP, LUA, C++
Joined
Aug 3, 2009
Messages
268
Reaction score
11
Location
Poland
Hello guys, is there any more efficient way to get ALL items on a certain tile than iterating the tile by stackpos?
I've found getItemsList() or sth like that but it returns only trash items like movables, grass and other decorations... It doesn't work for example with trees or statues.

Kindly thx in advance for any useful response
 
Code:
function getTileItems(pos)
    pos.stackpos = 0
    local v = getTileThingByPos(pos)
    local items = {}
    repeat
        pos.stackpos = pos.stackpos + 1
        v = getTileThingByPos(pos)
        table.insert(items, v)
    until v.itemid == 0
    pos.stackpos = pos.stackpos - 1
    return items
end

for _, item in pairs(getTileItems(pos)) do
  if (isMoveable(item.uid) == 1) then
       print("Itemid "..item.itemid.." is movable")
  end
end
 
Im not aware of all c++ functions already implemented, but why would you like to use that, if i may ask?
 
Back
Top