• 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!

Lua getContainerItem problem.

Nothxbye

Banned User
Joined
Jan 22, 2012
Messages
1,124
Reaction score
173
I wanna get every item in backpack but why it doesn't work?
This showing empty lines in console instead of item names.

Code:
containeruid = (getTileItemById({x=17830, y=21539, z=7}, 1988).uid) -- backpack id it's on the ground
for slot = 0, getContainerSize(containeruid)-1 do
local item = getContainerItem(containeruid, slot)
print(""..getItemName(item.uid).."")
end
 
Last edited:
It looks like it should work if you are using TFS 0.3 or 0.4.

Add in more Prints and do your own "Debugging"

Code:
print("Script started.")
containeruid = (getTileItemById({x=17830, y=21539, z=7}, 1988).uid) -- backpack id it's on the ground
if containeruid >= 70000 then
  print("Backpack Found!")
  for slot = 0, getContainerSize(containeruid)-1 do
    local item = getContainerItem(containeruid, slot)
    print(""..getItemName(item.uid).."")
  end
else
  print("No Backpack")
end
[CODE]
 
Script started.
Backpack Found!

But still empty lines. Seems like getContainerItem doesn't work poperly or i doing something wrong?

I using avesta smilar to otserv source.

@edit

When i replace getItemName by item.itemid it works.
 
Last edited:
Back
Top