Advertisement
Ninja8370

Remote Control Turtle

Mar 3rd, 2015
12,993
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.21 KB | None | 0 0
  1. rednet.open("right")
  2.  
  3. local function panel()
  4.  
  5.  term.clear()
  6.  term.setCursorPos(1,1)
  7.  print("Remote Control Turtle v2.2")
  8.  term.setCursorPos(1,10)
  9.  print("This turtle's ID is: "..os.getComputerID())
  10.  
  11. end
  12.  
  13.  
  14.  
  15. local function handle()
  16.  
  17.  id, msg = rednet.receive()
  18.  
  19.  if msg == "forward" then
  20.   turtle.forward()
  21.  end
  22.  
  23.  if msg == "back" then
  24.   turtle.back()
  25.  end
  26.  
  27.  if msg == "up" then
  28.   turtle.up()
  29.  end
  30.  
  31.  if msg == "down" then
  32.   turtle.down()
  33.  end
  34.  
  35.  if msg == "right" then
  36.   turtle.turnRight()
  37.  end
  38.  
  39.  if msg == "left" then
  40.   turtle.turnLeft()
  41.  end
  42.  
  43.  if msg == "uturn" then
  44.   turtle.turnRight()
  45.   turtle.turnRight()
  46.  end
  47.  
  48.  if msg == "dig" then
  49.   turtle.dig()
  50.  end
  51.  
  52.  if msg == "digdown" then
  53.   turtle.digDown()
  54.  end
  55.  
  56.  if msg == "digup" then
  57.   turtle.digUp()
  58.  end
  59.  
  60.  if msg == "place" then
  61.   turtle.place()
  62.  end
  63.  
  64.  if msg == "placedown" then
  65.   turtle.placeDown()
  66.  end
  67.  
  68.  if msg == "placeup" then
  69.   turtle.placeUp()
  70.  end
  71.  
  72.  if msg == "rsfront" then
  73.   rs.setOutput("front",true)
  74.   sleep(3)
  75.   rs.setOutput("front",false)
  76.  end
  77.  
  78.  if msg == "rsup" then
  79.   rs.setOutput("top",true)
  80.   sleep(3)
  81.   rs.setOutput("top",false)
  82.  end
  83.  
  84.  if msg == "rsdown" then
  85.   rs.setOutput("bottom",true)
  86.   sleep(3)
  87.   rs.setOutput("bottom",false)
  88.  end
  89.  
  90.  if msg == "inv1" then
  91.   turtle.select(1)
  92.  end
  93.  
  94.  if msg == "inv2" then
  95.   turtle.select(2)
  96.  end
  97.  
  98.  if msg == "inv3" then
  99.   turtle.select(3)
  100.  end
  101.  
  102.  if msg == "inv4" then
  103.   turtle.select(4)
  104.  end
  105.  
  106.  if msg == "inv5" then
  107.   turtle.select(5)
  108.  end
  109.  
  110.  if msg == "inv6" then
  111.   turtle.select(6)
  112.  end
  113.  
  114.  if msg == "inv7" then
  115.   turtle.select(7)
  116.  end
  117.  
  118.  if msg == "inv8" then
  119.   turtle.select(8)
  120.  end
  121.  
  122.  if msg == "inv9" then
  123.   turtle.select(9)
  124.  end
  125.  
  126.  if msg == "inv10" then
  127.   turtle.select(10)
  128.  end
  129.  
  130.  if msg == "inv11" then
  131.   turtle.select(11)
  132.  end
  133.  
  134.  if msg == "inv12" then
  135.   turtle.select(12)
  136.  end
  137.  
  138.  if msg == "inv13" then
  139.   turtle.select(13)
  140.  end
  141.  
  142.  if msg == "inv14" then
  143.   turtle.select(14)
  144.  end
  145.  
  146.  if msg == "inv15" then
  147.   turtle.select(15)
  148.  end
  149.  
  150.  if msg == "inv16" then
  151.   turtle.select(16)
  152.  end
  153. end
  154.  
  155.  
  156.  
  157.  
  158.  panel()
  159.  
  160.  while true do
  161.   panel()
  162.   handle()
  163.    
  164.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement