Guest User

mining

a guest
Oct 31st, 2016
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.58 KB | None | 0 0
  1. -- Mining software Developed for use with
  2. -- project red frame quarry...
  3. -- developed by Tiberium_117
  4. -- bug tested by ProNoob4Life
  5. -- Button Api by Direwolf 20
  6. -- requirements for code to run
  7. -- monitors on left and right of computer
  8. -- bundled cable comming out back
  9.  
  10. os.loadAPI("button")
  11.  
  12. m = peripheral.wrap("left")
  13. m2 = peripheral.wrap("right")
  14. CA = "Nothing"
  15.  
  16. m.clear()
  17. m2.clear()
  18.  
  19. function fillTable1()
  20.   button.setTable("HeadDown", lowerHead,"", 10,20,3,4)
  21.   button.setTable("HeadUp", raiseHead,"", 22,32,3,4)
  22.   button.setTable("Mine", mine,"", 10,20,6,7)
  23.   button.setTable("Mine 1 level", miningEvent,"", 22,36,6,7)
  24.   button.setTable("HeadLeft", headLeft,"", 10,20,9,10)
  25.   button.setTable("HeadRight", headRight,"",22,32,9,10)
  26.   button.setTable("Forward", forward,"",10,20,12,13)  
  27.   button.setTable("Reverse", reverse,"",22,32,12,13)
  28.   button.setTable("Left", left,"",10,20,15,16)
  29.   button.setTable("Right", right,"",22,32,15,16)
  30.   button.setTable("Cycle 1", cycle1,"",10,20,18,19)
  31.   button.setTable("CycleJim", cycleJim,"",22,32,18,19)
  32.   button.screen()
  33. end
  34.  
  35. function fillTable2()
  36.   button.setTable("2", cycle2,"",10,13,3,4)
  37.   button.setTable("3", cycle3,"",15,18,3,4)
  38.   button.setTable("4", cycle4,"",20,23,3,4)
  39.   button.setTable("5", cycle5,"",25,28,3,4)
  40.   button.setTable("6", cycle6,"",30,33,3,4)
  41.   button.setTable("7", cycle7,"",10,13,6,7)
  42.   button.setTable("8", cycle8,"",15,18,6,7)
  43.   button.setTable("9", cycle9,"",20,23,6,7)
  44.   button.setTable("10", cycle10,"",25,28,6,7)
  45.   button.setTable("11", cycle11,"",30,33,6,7)
  46.   button.setTable("12", cycle12,"",10,13,9,10)
  47.   button.setTable("13", cycle13,"",15,18,9,10)
  48.   button.setTable("14", cycle14,"",20,23,9,10)
  49.   button.setTable("15", cycle15,"",25,28,9,10)
  50.   button.setTable("16", cycle16,"",30,33,9,10)
  51.   button.setTable("jim", JIM,"",20,23,12,13)
  52. end
  53.  
  54. function getClick()
  55.   event,side,z,y = os.pullEvent("monitorTouch")
  56.   button.checkxy(x, y)
  57. end
  58.  
  59. function lowerHead()
  60.   CA = "LoweringHead"
  61.   sleep(1)
  62.   redstone.setBundledOutput("back", colors.magenta)
  63.   sleep(.5)
  64.   redstone.setBundledOutput("back", 0)
  65.   sleep(.5)
  66.   CA = "Nothing"
  67. end
  68.  
  69. function raiseHead()
  70.   CA = "RaisingHead"
  71.   sleep(1)
  72.   redstone.setBundledOutput("back", colors.orange)
  73.   sleep(.5)
  74.   redstone.setBundledOutput("back", 0)
  75.   sleep(.5)
  76.   CA = "Nothing"
  77. end
  78.  
  79. function mine()
  80.   CA = "PulsingMiningHead"
  81.   sleep(1)
  82.   redstone.setBundledOutput("back", colors.white)
  83.   sleep(.5)
  84.   redstone.setBundledOutput("back", 0)
  85.   slep(.5)
  86.   CA = "Nothing"
  87. end
  88.  
  89. function miningEvent()
  90.   CA = "Completing one mining cycle"
  91.   sleep(.5)
  92.   lowerHead()
  93.   sleep(.5)
  94.   for i = 1,16 do
  95.     mine()
  96.     headLeft()
  97.   end
  98.   lowerHead()
  99.   for i = 1,16 do
  100.     mine()
  101.     headRight()
  102.   end
  103.   sleep(.5)
  104.   CA = "Nothing"
  105. end
  106.  
  107. function headLeft()
  108.   CA = "Moving Head Left"
  109.   sleep(1)
  110.   redstone.setBundledOutput("back", colors.lightBlue)
  111.   sleep(.5)
  112.   redstone.setBundledOutput("back", 0)
  113.   sleep(.5)
  114.   CA = "Nothing"
  115. end
  116.  
  117. function headRight()
  118.   CA = "Moving head Right"
  119.   sleep(1)
  120.   redstone.setBundledOutput("back", colors.yellow)
  121.   sleep(.5)
  122.   redstone.setBundledOutput("back", 0)
  123.   sleep(.5)
  124.   CA = "Nothing"
  125. end
  126.  
  127. function forward()
  128.   CA = "Moving Miner Forward"
  129.   sleep(1)
  130.   redstone.setBundledOutput("back", colors.lime)
  131.   sleep(.5)
  132.   redstone.setBundledOutput("back", 0)
  133.   sleep(.5)
  134.   CA = "Nothing"
  135. end
  136.  
  137. function reverse()
  138.   CA = "Moving Miner Backwards"
  139.   sleep(1)
  140.   redstone.setBundledOutput("back", colors.pink)
  141.   sleep(.5)
  142.   redstone.setBundledOutput("back", 0)
  143.   sleep(.5)
  144.   CA = "Nothing"
  145. end
  146.  
  147. function left()
  148.   CA = "Moving Miner Left"
  149.   sleep(1)
  150.   redstone.setBundledOutput("back", colors.grey)
  151.   sleep(.5)
  152.   redstone.setBundledOutput("back", 0)
  153.   sleep(.5)
  154.   CA = "Nothing"
  155. end
  156.  
  157. function right()
  158.   CA = "Moving Miner Right"
  159.   sleep(1)
  160.   redstone.setBundledOutput("back", colors.lightGray)
  161.   sleep(.5)
  162.   redstone.setBundledOutput("back", 0)
  163.   sleep(.5)
  164.   CA = "Nothing"
  165. end
  166.  
  167. function cycleJim()
  168.   m.clear()
  169.   fillTable2()
  170. end
  171.  
  172. function printAction()
  173.   m2.setCursorPos(18,4)
  174.   m2.write(CA)
  175. end
  176.  
  177. function JIM()
  178.   CA = "UH....  FUCK NO!"
  179.   printAction()
  180.   sleep(10)
  181.   CA = "Nothing"
  182.   printAction()
  183. end
  184.  
  185. function cycle1()
  186.   for i = 1,70 do
  187.     miningEvent()
  188.   end
  189.   for i 1,70 do
  190.     raiseHead()
  191.   end
  192.   for i = 1,16 do
  193.     forward()
  194.   end
  195. end
  196.  
  197. function cycle2()
  198.   for i = 1,2 do
  199.     cycle1()
  200.   end
  201. end
  202.  
  203. function cycle3()
  204.   for i = 1,3 do
  205.     cycle1()
  206.   end
  207. end
  208.  
  209. function cycle4()
  210.   for i = 1,4 do
  211.     cycle1()
  212.   end
  213. end
  214.  
  215. function cycle5()
  216.   for i = 1,5 do
  217.     cycle1()
  218.   end
  219. end
  220.  
  221. function cycle6()
  222.   for i = 1,6 do
  223.     cycle1()
  224.   end
  225. end
  226.  
  227. function cycle7()
  228.   for i = 1,7 do
  229.     cycle1()
  230.   end
  231. end
  232.  
  233. function cycle8()
  234.   for i = 1,8 do
  235.     cycle1()
  236.   end
  237. end
  238.  
  239. function cycle9()
  240.   for i = 1,9 do
  241.     cycle1()
  242.   end
  243. end
  244.  
  245. function cycle10()
  246.   for i = 1,10 do
  247.     cycle1()
  248.   end
  249. end
  250.  
  251. function cycle11()
  252.   for i = 1,11 do
  253.     cycle1()
  254.   end
  255. end
  256.  
  257. function cycle12()
  258.   for i = 1,12 do
  259.     cycle1()
  260.   end
  261. end
  262.  
  263. function cycle13()
  264.   for i = 1,13 do
  265.     cycle1()
  266.   end
  267. end
  268.  
  269. function cycle14()
  270.   for i = 1,14 do
  271.     cycle1()
  272.   end
  273. end
  274.  
  275. function cycle15()
  276.   for i = 1,15 do
  277.     cycle1()
  278.   end
  279. end
  280.  
  281. function cycle16()
  282.   for i = 1,16 do
  283.     cycle1()
  284.   end
  285. end
  286. fillTable1()
  287. button.heading("Tiberium Mining Software version 0.0.1")
  288. m2.setCursorPos(1,1)
  289. m2.write("Tiberium Mining Software Version 0.0.1")
  290. m2.setCursorPos(1,4)
  291. m2.write("Current Action:  ")
  292. m2.write(CA)
  293. while true do
  294.   printAction()
  295.   getClick()
  296. end
Advertisement
Add Comment
Please, Sign In to add comment