Advertisement
albin900

Turtle control

Dec 9th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. rednet.open("right")
  2. turtle.refuel()
  3. print("Computer id: ", os.getComputerID())
  4.  
  5. c = 0
  6.  
  7. rednet.broadcast("Turtle got online! My id: ", os.getComputerID())
  8.  
  9. while true do
  10.     computer, action = rednet.receive()
  11.     print("Got connection from: ", computer, "action: ", action)
  12.  
  13.  
  14.  
  15.     if action == "forward" then
  16.     turtle.forward()
  17.     end
  18.  
  19.     if action == "forward 10" then
  20.     turtle.forward(10)
  21.     end
  22.  
  23.     if action == "forward 5" then
  24.     turtle.forward(5)
  25.     end
  26.  
  27.     if action == "back" then
  28.     turtle.turnLeft()
  29.     turtle.turnLeft()
  30.     turtle.forward()
  31.     turtle.turnLeft()
  32.     turtle.turnLeft()
  33.     end
  34.  
  35.     if action == "left" then
  36.     turtle.turnLeft()
  37.     end
  38.    
  39.     if action == "right" then
  40.     turtle.turnRight()
  41.     end
  42.  
  43.     if action == "fuel" then
  44.     turtle.refuel()
  45.     end
  46.  
  47.     if action == "attack" then
  48.     turtle.attack()
  49.     end
  50.  
  51.     if action == "up" then
  52.     turtle.up()
  53.     end
  54.  
  55.     if action == "down" then
  56.     turtle.down()
  57.     end
  58.  
  59.     if action == "mine" then
  60.     turtle.dig()
  61.     end
  62.  
  63.     action = "none"
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement