Advertisement
cory1234567

OC Tunnel Script

Feb 25th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.26 KB | None | 0 0
  1. local args = {...}
  2. local component = require("component")
  3. local robot = require("robot")
  4. local computer = require("computer")
  5.  
  6. function light() --places torces to the right on the block beside it
  7.   count = 1
  8.   if count >= 10 then
  9.     count = 0
  10.     robot.select(14)
  11.     robot.turnRight()
  12.     robot.place()
  13.     robot.turnLeft()
  14.   else
  15.     count = count+1
  16.     print(count)
  17.   end
  18. end
  19.  
  20. function chkFull() --checks to see if the inventory is full
  21.  
  22. end
  23.  
  24. function chkFuel()--checks on the fuel level and adds coal as needed
  25. local g = component.generator
  26. print(g.count())
  27. robot.select(16)
  28.     if g.count() == 0 then g.insert(1) end
  29.     if g.count() <= 10 then
  30.         g.insert(10 - g.count())
  31.     end
  32. end
  33.  
  34. function mainLoop() -- main digging function
  35.   robot.swing()
  36.   robot.forward()
  37.   robot.turnLeft()
  38.   robot.swing()
  39.   robot.swingUp()
  40.   robot.up()
  41.   robot.swing()
  42.   robot.swingUp()
  43.   robot.up()
  44.   robot.swing()
  45.   robot.turnLeft()
  46.   robot.turnLeft()
  47.   robot.swing()
  48.   robot.down()
  49.   robot.swing()
  50.   robot.down()
  51.   robot.swing()
  52.   robot.turnLeft()
  53. end
  54.  
  55. robot.select(16)
  56. if args[1] == nil then args[1] = 1 end
  57.  
  58. for i = 1,args[1] do
  59.   print("Interation: "..tostring(i).." of "..tostring(args[1]))
  60.   chkFuel()
  61.   --chkFull()
  62.   mainLoop()
  63.   light()
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement