Advertisement
LDDestroier

Turtle Control

Sep 23rd, 2014
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.24 KB | None | 0 0
  1. mineshaftLength = 12
  2. cellLength = 1
  3. msg = 0
  4. print("Computercraft Turtle Control Client")
  5. print("-----------------------------------")
  6. print("   W     E  T Y")
  7. print(" A S D   Q  G H")
  8. print(" U I O P    B N")
  9. while true do
  10.   local event, msg = os.pullEvent("char")
  11.   for a = 1, 9, 1 do
  12.     if tonumber(msg) == a then
  13.       cellLength = a
  14.       write(cellLength)
  15.     end
  16.   end
  17.   if msg == "w" then
  18.     turtle.forward()
  19.   end
  20.   if msg == "a" then
  21.     turtle.turnLeft()
  22.   end
  23.   if msg == "s" then
  24.     turtle.back()
  25.   end
  26.   if msg == "d" then
  27.     turtle.turnRight()
  28.   end
  29.   if msg == "e" then
  30.     turtle.up()
  31.   end
  32.   if msg == "q" then
  33.     turtle.down()
  34.   end
  35.  
  36.   if msg == "t" then
  37.     turtle.attackUp()
  38.   end
  39.   if msg == "g" then
  40.     turtle.attack()
  41.   end
  42.   if msg == "b" then
  43.     turtle.attackDown()
  44.   end
  45.  
  46.   if msg == "y" then
  47.     turtle.digUp()
  48.   end
  49.   if msg == "h" then
  50.     turtle.dig()
  51.   end
  52.   if msg == "n" then
  53.     turtle.digDown()
  54.   end
  55.  
  56.   if msg == "i" then
  57.     for a = 1, mineshaftLength, 1 do
  58.       for b = 1, cellLength, 1 do
  59.         turtle.dig()
  60.         turtle.forward()
  61.         turtle.digUp()
  62.         turtle.digDown()
  63.         turtle.turnLeft()
  64.         turtle.dig()
  65.         turtle.forward()
  66.         turtle.digUp()
  67.         turtle.digDown()
  68.         turtle.turnLeft()
  69.         turtle.turnLeft()
  70.         turtle.forward()
  71.         turtle.dig()
  72.         turtle.forward()
  73.         turtle.digUp()
  74.         turtle.digDown()
  75.         turtle.turnLeft()
  76.         turtle.turnLeft()
  77.         turtle.forward()
  78.         turtle.turnRight()
  79.       end
  80.       turtle.digDown()
  81.       turtle.down()
  82.     end
  83.   end
  84.   if msg == "o" then
  85.     for a = 1, mineshaftLength, 1 do
  86.       for b = 1, cellLength, 1 do
  87.         turtle.dig()
  88.         turtle.forward()
  89.         turtle.digUp()
  90.         turtle.digDown()
  91.         turtle.turnLeft()
  92.         turtle.dig()
  93.         turtle.forward()
  94.         turtle.digUp()
  95.         turtle.digDown()
  96.         turtle.turnLeft()
  97.         turtle.turnLeft()
  98.         turtle.forward()
  99.         turtle.dig()
  100.         turtle.forward()
  101.         turtle.digUp()
  102.         turtle.digDown()
  103.         turtle.turnLeft()
  104.         turtle.turnLeft()
  105.         turtle.forward()
  106.         turtle.turnRight()
  107.       end
  108.     end
  109.   end
  110.   if msg == "p" then
  111.     for a = 1, mineshaftLength, 1 do
  112.       for b = 1, cellLength, 1 do
  113.         turtle.dig()
  114.         turtle.forward()
  115.         turtle.digUp()
  116.         turtle.digDown()
  117.         turtle.turnLeft()
  118.         turtle.dig()
  119.         turtle.forward()
  120.         turtle.digUp()
  121.         turtle.digDown()
  122.         turtle.turnLeft()
  123.         turtle.turnLeft()
  124.         turtle.forward()
  125.         turtle.dig()
  126.         turtle.forward()
  127.         turtle.digUp()
  128.         turtle.digDown()
  129.         turtle.turnLeft()
  130.         turtle.turnLeft()
  131.         turtle.forward()
  132.         turtle.turnRight()
  133.       end
  134.       turtle.digUp()
  135.       turtle.up()
  136.     end
  137.   end
  138.   if msg == "u" then
  139.     turtle.up()
  140.     turtle.placeDown()
  141.     turtle.forward()
  142.     turtle.placeDown()
  143.     turtle.forward()
  144.     turtle.placeDown()
  145.     turtle.forward()
  146.     turtle.placeDown()
  147.     turtle.forward()
  148.     turtle.placeDown()
  149.     turtle.turnRight()
  150.     turtle.forward()
  151.     turtle.placeDown()
  152.     turtle.forward()
  153.     turtle.placeDown()
  154.     turtle.turnRight()
  155.     turtle.forward()
  156.     turtle.forward()
  157.     turtle.placeDown()
  158.     turtle.turnRight()
  159.     turtle.forward()
  160.     turtle.placeDown()
  161.     turtle.turnRight()
  162.     turtle.turnRight()
  163.     turtle.forward()
  164.     turtle.forward()
  165.     turtle.forward()
  166.     turtle.turnLeft()
  167.     turtle.forward()
  168.     turtle.forward()
  169.     turtle.placeDown()
  170.     turtle.turnRight()
  171.     turtle.turnRight()
  172.     turtle.forward()
  173.     turtle.placeDown()
  174.     turtle.forward()
  175.     turtle.placeDown()
  176.     turtle.forward()
  177.     turtle.placeDown()
  178.     turtle.forward()
  179.     turtle.placeDown()
  180.     turtle.turnLeft()
  181.     turtle.forward()
  182.     turtle.placeDown()
  183.     turtle.forward()
  184.     turtle.placeDown()
  185.     turtle.turnLeft()
  186.     turtle.forward()
  187.     turtle.placeDown()
  188.     turtle.forward()
  189.     turtle.placeDown()
  190.     turtle.forward()
  191.     turtle.placeDown()
  192.     turtle.forward()
  193.     turtle.placeDown()
  194.     turtle.turnRight()
  195.     turtle.forward()
  196.     turtle.down()
  197.   end
  198. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement