Posted 15 December 2018 - 04:14 PM
local chest = peripheral.wrap("left")
for i,v in pairs(chest.getStackInSlot(1)) do
print(i," : ",v)
if v == "LOOT_CHEST" then
print("Loot chest found")
else
print("oh noes someone stole the rainboww!!")
end
end
So basically, I have a chest containing an item, and my computer is checking the item info, I have a chest inside the chest called "LOOT CHEST"
Ultimately I want to be able to check if an item in chest matches ID And display_name. the problem is, its kinda in the table like such: table.display_name with display_name being the first field and the name itself being the second (did I just overcomplicate the explanation?)
Am i missing something?
Right now im getting like 15 oh noes messages coming up XD.
If i do this:
chest = peripheral.wrap("left")
local inf = {chest.getStackInSlot(1)
if inf[1] == "LOOT_CHEST" then
print("found loot chest)
else
print("Oh noez! Someone stole teh rainbow!!")
end
I get the Oh noez message even though the chest is n chest slot 1
Any help is appreciated :)/>
Edit: I'll get there, just solved it myself. Turns out I misread the original item info returned
My Loot Chest was actually called "LOOT CHEST" instead of "LOOT_CHEST"
Edited on 15 December 2018 - 03:25 PM