Advertisement
kovakovi2000

_MASTER

Feb 13th, 2021 (edited)
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.81 KB | None | 0 0
  1. term.clear()
  2. if not fs.exists("rnc2") then
  3.     shell.run("pastebin","get","7UH6rt36","rnc2")
  4. end
  5. os.loadAPI("rnc2")
  6.  
  7. local prg = shell.getRunningProgram()
  8. rnc2.setPort(prg, 600)
  9. rnc2.setIdenty(prg, 100)
  10. rnc2.setTimeOut(prg, 2)
  11.  
  12. if turtle.detectDown() then
  13.     turtle.digDown()
  14. end
  15.  
  16. if turtle.detectUp() then
  17.     turtle.digUp()
  18. end
  19.  
  20. turtle.select(1)
  21. turtle.placeUp()
  22. local tmin = 10000
  23. local tmax = 0
  24. local sucked = 1
  25. local ERRORS = 2
  26.  
  27. while sucked ~= 129 do
  28.     if turtle.suckUp() then
  29.         while not turtle.placeDown() do end
  30.         peripheral.call("bottom", "turnOn")
  31.         sleep(0.3)
  32.         temp = peripheral.wrap("bottom")
  33.         local message = "t_" .. temp.getID() .. " fg liningup " .. sucked
  34.         local expect = "t_" .. temp.getID() .. "> Command resived!"
  35.         local res = nil
  36.         local continue = false
  37.         local send = true
  38.         repeat
  39.             res = nil
  40.             continue = false
  41.  
  42.             --print(message)
  43.             if send then
  44.                 rnc2.setIdenty(prg,100)
  45.                 rnc2.send(prg, message)
  46.                 send = false
  47.             end
  48.            
  49.             rnc2.setIdenty(prg,101)
  50.             local res = rnc2.resive(prg)
  51.             if res == expect then
  52.                 continue = true
  53.                 --print(res)
  54.             else
  55.                 if res == nil then
  56.                     res = "nil"
  57.                     send = true
  58.                 end
  59.                 term.setCursorPos(1,ERRORS)
  60.                 print("ERROR on " .. temp.getID() .. ":\"" .. res .. "\"")
  61.                 ERRORS = ERRORS + 1
  62.             end
  63.         until continue
  64.         term.setCursorPos(1,1)
  65.         print("success started " .. sucked)
  66.         sucked = sucked + 1
  67.         if temp.getID() > tmax then
  68.             tmax = temp.getID()
  69.         elseif temp.getID() < tmin then
  70.             tmin = temp.getID()
  71.         end
  72.     end
  73. end
  74.  
  75. turtle.digUp()
  76. local forward = 7
  77. while forward ~= 0 do
  78.     if turtle.forward() then
  79.         forward = forward - 1
  80.     end
  81. end
  82. turtle.select(2)
  83. turtle.place()
  84. local backword = 7
  85. while backword ~= 0 do
  86.     if turtle.back() then
  87.         backword = backword - 1
  88.         turtle.place()
  89.     end
  90. end
  91. turtle.turnLeft()
  92. turtle.turnLeft()
  93. turtle.select(3)
  94. turtle.place()
  95. turtle.select(2)
  96. term.setCursorPos(1,1)
  97. print("                        ")
  98. sucked = 1
  99. while sucked ~= 129 do
  100.     if turtle.detectUp() and turtle.digUp() and turtle.drop() then
  101.         sucked = sucked + 1
  102.         term.setCursorPos(1,1)
  103.         print("success collected " .. sucked)
  104.     end
  105. end
  106.  
  107. turtle.turnLeft()
  108. turtle.turnLeft()
  109. turtle.select(4)
  110. turtle.drop()
  111. turtle.select(1)
  112. turtle.dig()
  113. forward = 7
  114. while forward ~= 0 do
  115.     if turtle.forward() then
  116.         forward = forward - 1
  117.         turtle.dig()
  118.     end
  119. end
  120. backword = 7
  121. while backword ~= 0 do
  122.     if turtle.back() then
  123.         backword = backword - 1
  124.     end
  125. end
  126. turtle.turnLeft()
  127. turtle.turnLeft()
  128. turtle.dig()
  129. turtle.turnLeft()
  130. turtle.turnLeft()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement