Don't like ads? PRO users don't see any ads ;-)
Guest

seiti

By: a guest on Mar 16th, 2012  |  syntax: Lua  |  size: 2.13 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. --------------------------
  2. -- Seiti (level the ground) ver.1.00
  3. --
  4. -- "Please" Download fwcount together.
  5. --------------------------
  6.  
  7.  
  8.  
  9. --------------------------
  10. -- Information is heard.
  11. --------------------------
  12.  
  13. print("Change under block mode?")
  14. print(" Yes = y,No = n")
  15. sm = io.read()
  16.  
  17. print("Is distance measured?")
  18. print(" Yes = y,No = n")
  19.  
  20. yn = io.read()
  21. if yn == "y" then
  22.         dofile("fwcount")
  23.                 else
  24.                 print("OK No command")
  25.         end
  26.  
  27. if yn == "y" then
  28.  
  29.         print("Does this nonber use?")
  30.         print("Yes = y , No = n")
  31.         yn = io.read()
  32.                 else
  33.         yn = "n"
  34. end
  35.  
  36. if yn == "n" then
  37.         print("---------------------------")
  38.         print("Take forward Counts?")
  39.         x = io.read()
  40.         print("Take Wide Counts?")
  41.         y = io.read()
  42. end
  43.  
  44. --------------------
  45. -- finction
  46. --------------------
  47.  
  48. function put()
  49.  
  50.         if turtle.detectDown() == false then
  51.                 turtle.placeDown()
  52.                 elseif turtle.compareDown() == false then
  53.                 turtle.digDown()
  54.                 turtle.placeDown()
  55.                 else
  56.         end
  57. end
  58.  
  59. function dig()
  60. i = 1
  61.         for i = 1,x do
  62.         if sm == "y" then
  63.         put()
  64.         end
  65.                 while turtle.detect() or turtle.detectUp() == true do
  66.                 turtle.digUp()
  67.                 turtle.up()
  68.                 end
  69.                 while turtle.detectUp() == false do
  70.                 turtle.down()
  71.                 turtle.dig()
  72.                 if turtle.detectDown() == true then
  73.                 break
  74.                 end
  75.                 end
  76.                 turtle.forward()
  77.         i = i + 1
  78.         end
  79.         put()
  80. end
  81.  
  82.  
  83. function back()
  84.         i = 1
  85.         for i = 1,x do
  86.                 turtle.back()
  87.         i = i + 1
  88.         end
  89. drop()
  90. end
  91.  
  92. function drop()
  93.         turtle.turnRight()
  94.         turtle.turnRight()
  95.         i = 2
  96.         for i = i,9 do
  97.                 turtle.select(i)
  98.                         if turtle.compareDown() == true then
  99.                         break
  100.                 else
  101.                         turtle.drop(i)
  102.         end
  103. end
  104.  
  105.  
  106. turtle.select(1)
  107. turtle.turnLeft()
  108. turtle.turnLeft()
  109. end
  110.  
  111.  
  112. function turn()
  113.         turtle.turnRight()
  114.         turtle.dig()
  115.         turtle.forward()
  116.                 while turtle.detectUp == true do
  117.                         turtle.digUp()
  118.                         turtle.up()
  119.                 end
  120.                 while turtle.detectUp == false do
  121.                         turtle.down()
  122.                 end
  123.         turtle.turnLeft()
  124. end
  125.  
  126. --------------------
  127. -- move turtle
  128. --------------------
  129. w = 1
  130. for w = 1,y do
  131. dig()
  132. back()
  133. turn()
  134. w = w + 1
  135. end
  136. dig()
  137. back()
  138.  
  139. turtle.turnRight()
  140. for i= 1,y do
  141.         turtle.back()
  142. end
  143. turtle.turnLeft()
  144. print("Finish")