Kaerius

DigiDigi

Dec 24th, 2012
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.82 KB | None | 0 0
  1. print("Visota (0>): ")
  2. cona = tonumber(read())
  3. a = cona
  4. print("Dlina(vperod)(1>): ")
  5. back = tonumber(read())
  6. dlina = back
  7. print("Shirina (1>): ")
  8. shirina = tonumber(read())
  9. width = shirina
  10. print("Up/Down mod (u/d)")
  11. conUD= read()
  12. UD= conUD
  13. print("Left or Right? (l/r) or 'stop'")
  14. ConTurn = read()
  15. Turn = ConTurn
  16. print("gravel/sand control mod (y/n)")
  17. GControl = read()
  18. Control = GControl
  19. print("-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/")
  20.  
  21. while width > 0 do
  22.  if Turn == "stop" then
  23.   break
  24.  else
  25.   while dlina > 0 do
  26.    turtle.dig()
  27.    if  Control == "y" then
  28.     sleep(0.4)
  29.     while turtle.detect() do
  30.      turtle.dig()
  31.     end
  32.    end
  33.    turtle.forward()
  34.    
  35.    while a > 0 do
  36.     if UD == "d" then
  37.      turtle.digDown()
  38.     turtle.down()
  39.      a = a - 1
  40.    else
  41.      turtle.digUp()
  42.     if Control == "y" then
  43.      sleep(0.4)
  44.       while turtle.detectUp() do
  45.        turtle.digUp()
  46.       end
  47.     end
  48.      turtle.up()
  49.      a = a - 1
  50.     end
  51.    end
  52.    a = cona
  53.  
  54.    while a > 0 do
  55.     if UD == "d" then
  56.     turtle.up()
  57.      a = a - 1
  58.    else
  59.      turtle.down()
  60.      a = a - 1
  61.    end
  62.    end
  63.    a = cona
  64.  
  65.   dlina = dlina - 1
  66.   end
  67.   dlina = back
  68.  
  69.   while dlina > 0 do
  70.    turtle.back()
  71.    dlina = dlina - 1
  72.   end
  73.   dlina = back
  74.  
  75.   if Turn == "l" then
  76.    turtle.turnLeft()
  77.    turtle.dig()
  78.    turtle.forward()
  79.    turtle.turnRight()
  80.   else
  81.    turtle.turnRight()
  82.    turtle.dig()
  83.    turtle.forward()
  84.    turtle.turnLeft()
  85.   end
  86.  end
  87.  width = width - 1
  88. end
  89. width = shirina
  90.  
  91.  if Turn == "stop" then
  92.   print("Work is suspended by the user.")
  93.  elseif Turn == "l" then
  94.   turtle.turnLeft()
  95.   while width > 0 do
  96.    turtle.back()
  97.    width = width - 1
  98.   end
  99.   turtle.turnRight()
  100.  else
  101.   turtle.turnRight()
  102.   while width > 0 do
  103.    turtle.back()
  104.    width = width - 1
  105.   end
  106.   turtle.turnLeft()
  107.  end
  108. width = shirina
  109.  
  110. if Turn == "stop" then
  111.  print("-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/")
  112. else
  113.  if cona == 0 and back ~= 0 and shirina ~= 0 then
  114.   colvo = back * shirina
  115.  elseif cona ~= 0 and back == 0 and shirina ~= 0 then
  116.   colvo = cona * shirina
  117.  elseif cona ~= 0 and back ~= 0 and shirina == 0 then
  118.   colvo = cona * back
  119.  elseif cona ~= 0 and back == 0 and shirina == 0 then
  120.   colvo = cona
  121.  elseif cona == 0 and back ~= 0 and shirina == 0 then
  122.   colvo = back
  123.  elseif cona == 0 and back == 0 and shirina ~= 0 then
  124.   colvo = shirina
  125.  else
  126.   colvo = (cona + 1) * back * shirina
  127. end
  128.  
  129. slots = 9
  130. collected = 0
  131. while slots > 0 do
  132.  collected = collected + turtle.getItemCount(slots)
  133.  slots = slots -1
  134. end
  135.  
  136. filled = (collected/576) * 100
  137. KPD = (collected/colvo) *100
  138. print("distance: ", back)
  139. print("Total blocks checked: ", colvo)
  140. print("Total blocks collected: ",collected)
  141. print("Slots filled with: ", filled,"%")
  142. print("KPD: ", KPD,"%")
  143.  
  144. slots = 9
  145. collected = 0
  146. end
Add Comment
Please, Sign In to add comment