Advertisement
Guest User

mazesolve

a guest
May 4th, 2013
685
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. --This will turn the light on!
  2. function turnOnLight()
  3.  if turtle.compare() then
  4.   redstone.setOutput("front", true)
  5.   sleep(10)
  6.   redstone.setOutput("front", false)
  7.  end
  8. end
  9.  
  10. --This line makes sure that
  11. --it is comparing the first item
  12. turtle.select(1)
  13.  
  14. while true do
  15.  sleep(0)
  16.  if not turtle.detect() then
  17.   turtle.forward()
  18.   turnOnLight()
  19.   turtle.turnRight()
  20.   if turtle.detect() then
  21.    turtle.turnLeft()
  22.   end
  23.  else
  24.   turtle.turnRight()
  25.   if turtle.detect() then
  26.    turtle.turnLeft()
  27.    turtle.turnLeft()
  28.   end
  29.  end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement