logInfo(player.Name, "\tSlot \t\tQuality\t\tValue\t\tItem Name",false)
for slot = 61, 120 do
local item = inventory.BagSlot[slot]
if item then
logInfo(player.Name, "\t"..slot.."\t\t"..item.Quality.."\t\t"..item.Value.."\t\t"..item.Name,false)
end
end
the problem that I'm seeing with this is that it always creates an entry for every bag slot, regardless of if it has something in it or not. Sample output:
Slot Quality Value Item Name
61 0 0 <EMPTY>
62 2 1071 Harvest God Star Stone
63 3 10 Recipe - Sealer's Totem Flag
64 8 0 Arcane Transmutor Charge
65 0 0 <EMPTY>
66 2 10 Recipe - Large Exquisite Advanced Iron Chest
67 0 15 Phirius Potion - Type B
68 0 0 <EMPTY>
69 3 2 Lyliya's Colorful Glass Bead
70 0 0 <EMPTY>
71 0 15 Phirius Elixir - Type B
72 2 10 Recipe - Large Exquisite Superior Iron Chest
73 0 0 <EMPTY>
74 0 0 <EMPTY>
75 0 0 <EMPTY>
76 0 0 <EMPTY>
77 0 0 <EMPTY>
78 0 0 <EMPTY>
79 0 0 <EMPTY>
80 0 0 <EMPTY>
How would I get that to not log when the slot is empty? I thought the "if item then" would only log when there's an item in the slot, but apparently not.
An empty slot still returns a table of information about that slot, such as its bagid, that it's empty, whether its locked, etc. After all, that slot exists whether it's empty or not. As you can see empty slots have a name of "<EMPTY>" and an id of 0. So you could check for name or id but know that the name causes problems in xml files because of those brackets. So typically we use the id.