Advertisement
1lann

turtle

Aug 9th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local control = 236
  2. local objects = {"Obsidian"}
  3.  
  4. rednet.open("right")
  5.  
  6. while true do
  7.     id, msg = rednet.receive()
  8.     if id == control then
  9.         command = loadstring(msg)
  10.         toDo = setfenv(command, getfenv(1))
  11.         toDo()
  12.         front = "Unknown"
  13.         if turtle.detect() then
  14.             for i = 1, #objects do
  15.                 turtle.select(i)
  16.                 if turtle.compare() then
  17.                     front = objects[i]
  18.                     break
  19.                 end
  20.             end
  21.         else
  22.             front = "Air"
  23.         end
  24.         if front == "Turtle" then
  25.             --turtle.dig()
  26.         end
  27.         up = "Unknown"
  28.         if turtle.detectUp() then
  29.             for i = 1, #objects do
  30.                 turtle.select(i)
  31.                 if turtle.compareUp() then
  32.                     up = objects[i]
  33.                     break
  34.                 end
  35.             end
  36.         else
  37.             up = "Air"
  38.         end
  39.         if up == "Turtle" then
  40.             --turtle.digUp()
  41.         end
  42.         down = "Unknown"
  43.         if turtle.detectDown() then
  44.             for i = 1, #objects do
  45.                 turtle.select(i)
  46.                 if turtle.compareDown() then
  47.                     down = objects[i]
  48.                     break
  49.                 end
  50.             end
  51.         else
  52.             down = "Air"
  53.         end
  54.         if down == "Turtle" then
  55.             --turtle.digDown()
  56.         end
  57.         toSend = textutils.serialize({ret, front, up, down})
  58.         rednet.send(control, toSend)
  59.     end
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement