Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- os.loadAPI("ocs/apis/sensor")
- mon = peripheral.wrap("front")
- mon.clear()
- mon.setTextScale(0.5)
- rs.setOutput("left",false)
- rs.setOutput("right",false)
- sleep(0.5)
- sen = sensor.wrap("bottom")
- gx,gy = mon.getSize()
- while true do
- s = sen.getTargets()
- yx = 2
- mon.clear()
- f = 0
- for v,k in pairs(s) do
- s1 = sen.getTargetDetails(v)
- x = s1.Position.X
- y = s1.Position.Y
- z = s1.Position.Z
- mon.setCursorPos(2,yx)
- mon.write(v)
- mon.setCursorPos(18,yx)
- mon.write("X: " .. string.format("%d",x))
- mon.setCursorPos(24,yx)
- mon.write("Y: " .. string.format("%d",y))
- mon.setCursorPos(30,yx)
- mon.write("Z: " .. string.format("%d",z))
- if x < 3 and x > -3 and z > -12 and z < 8 then
- f = f + 1
- n = "INSIDE"
- else
- n = "OUTSIDE"
- end
- mon.setCursorPos(36,yx)
- mon.write("Position: " .. n)
- mon.setCursorPos(54,yx)
- mon.write("Held Item: " .. s1.HeldItem.Name)
- yx = yx + 1
- end
- if f == 0 then
- for b = 1,3,1 do
- rs.setOutput("right",true)
- sleep(0.5)
- rs.setOutput("right",false)
- sleep(0.5)
- --mon.setCursorPos(gx-5,gy)
- --mon.write("CLOSE")
- end
- else
- for b = 1,3,1 do
- rs.setOutput("left",true)
- sleep(0.5)
- rs.setOutput("left",false)
- sleep(0.5)
- --mon.setCursorPos(gx-5,gy)
- --mon.write("OPEN")
- end
- sleep(0.5)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement