Help with identifying empty bag slot
Posted: Mon Dec 16, 2013 12:09 pm
I have a part of code where I log my current inventory:
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:
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.
Code: Select all
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
endCode: Select all
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>