Posted 21 March 2014 - 06:49 PM
m = peripheral.wrap("top")
keyItem = "Lever"
function emptyPlayer()
for i = 28,36 do
m.pushItem("west",i,64)
end
end
function checkKey()
local slotInfo = m.getStackInSlot(10)
if slotInfo ~= nil then
if slotInfo.name == keyItem then
print("Key Found")
end
end
end
I wrote this little piece of code with a Player Interface from the Random Things mod so that whenever I have a lever in the top left of my inventory it will dump all the items from the row above my hotbar into a chest.
Now I want to call these two functions in a loop where it constanly checks if I have the key in that slot, and if I do it calls the emptyPlayer function. I don't however know how to put the checkKey in an if statement (If that is even the way to do it)