Posted 28 March 2014 - 01:23 AM
I have been trying to get this to open a door when I am nearby. I am also wondering if there is a way to lower the range of the sensor so it will only open when I am within two blocks of it. At the moment the code that I have doesn't function properly. It works when I am there, but when I'm not it won't close. I am using a TiCo drawbridge as the door, so it is inverted.
m = peripheral.wrap("right")
while true do
sleep(1)
names = m.getPlayerNames()
for i = 1, #names do
if names[i] == "ligglo" then
redstone.setOutput("left", false)
else
redstone.setOutput("left", true)
end
end
end