Advertisement
Guest User

read

a guest
Dec 5th, 2012
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.95 KB | None | 0 0
  1. sign = peripheral.wrap("right")
  2. while true do
  3.   if turtle.detect() then
  4.     text1,text2,text3,text4 = sign.read()
  5.     if text1 == "Left" or text1 == "left" or text1 == "LEFT" then
  6.       turtle.turnLeft()
  7.       turtle.forward()
  8.     elseif text1 == "Right" or text1 == "right" or text1 == "RIGHT" then
  9.       turtle.turnRight()
  10.       turtle.forward()
  11.     elseif text1 == "Stop" or text1 == "stop" or text1 == "STOP" then
  12.       break
  13.     elseif text1 == "Break" or text1 == "break" or text1 == "BREAK" then
  14.       turtle.dig()
  15.       turtle.forward()
  16.       turtle.dig()
  17.       turtle.back()
  18.       turtle.place("Stop")
  19.     elseif text1 == "Forward" or text1 == "forward" or text1 == "FORWARD" then
  20.       turtle.dig()
  21.       turtle.forward()
  22.     elseif test1 == "Back" or text1 == "back" or text1 == "BACK" then
  23.       turtle.back()
  24.     elseif text1 == "Up" or text1 == "up" or text1 == "UP" then
  25.       turtle.digUp()
  26.       turtle.up()
  27.     elseif text1 == "Down" or text1 == "down" or text1 == "DOWN" then
  28.       turtle.digDown()
  29.       turtle.down()
  30.     elseif text1 == "Dance" or text1 == "dance" or text1 == "DANCE" then
  31.       shell.run("dance")
  32.     elseif text1 == "Craft" or text1 == "craft" or text1 == "CRAFT" then
  33.       turtle.craft()
  34.     elseif text1 == "Place" or text1 == "place" or text1 == "PLACE" then
  35.       if text2 ~= nil then
  36.         text2 = tonumber(text2)
  37.         turtle.select(text2)
  38.       end
  39.       if text3 ~= nil and text4 == nil then
  40.         turtle.dig()
  41.         turtle.place(text3)
  42.       elseif text3 == nil and text4 == nil then
  43.         turtle.dig()
  44.         turtle.place()
  45.       elseif text3 ~= nil and text4 ~= nil then
  46.         if text4 == "right" or text4 == "Right" or text4 == "RIGHT" then
  47.           turtle.turnRight()
  48.           turtle.place(text3)
  49.           turtle.turnLeft()
  50.         elseif text4 == "left" or text4 == "Left" or text4 == "LEFT" then
  51.           turtle.turnLeft()
  52.           turtle.place(text3)
  53.           turtle.turnRight()
  54.         elseif text4 == "up" or text4 == "Up" or text4 == "UP" then
  55.           turtle.placeUp(text3)
  56.         elseif text4 == "down" or text4 == "Down" or text4 == "DOWN" then
  57.           turtle.placeDown(text3)
  58.         end
  59.         turtle.dig()
  60.       elseif text3 == nil and text4 ~= nil then
  61.         if text4 == "right" or text4 == "Right" or text4 == "RIGHT" then
  62.           turtle.turnRight()
  63.           turtle.place()
  64.           turtle.turnLeft()
  65.         elseif text4 == "left" or text4 == "Left" or text4 == "LEFT" then
  66.           turtle.turnLeft()
  67.           turtle.place()
  68.           turtle.turnRight()
  69.         elseif text4 == "up" or text4 == "Up" or text4 == "UP" then
  70.           turtle.placeUp()
  71.         elseif text4 == "down" or text4 == "Down" or text4 == "DOWN" then
  72.           turtle.placeDown()
  73.         end
  74.         turtle.dig()
  75.       end
  76.       print(text1)
  77.     else
  78.       error(text1.." is an unrecognised Sign Command.")  
  79.     end
  80.   else
  81.     error("No sign found.")
  82.   end
  83. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement