Illprotectjew

Quarry

Jul 11th, 2013
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.66 KB | None | 0 0
  1. local choice = ""
  2. local t = turtle
  3. tgf = turtle.getFuelLevel()
  4. fuelLimit = 1
  5. ready = false
  6. runcheck = 0
  7.  
  8.  
  9. function WriteMenu()
  10.         term.clear()
  11.         term.setCursorPos(1, 1)
  12.         print("+--Mega Quarry 9000 by IllProtectJu--+")
  13.     os.sleep(1)
  14.         if ready == true then
  15.                 print("If I'm fully stocked with the items below then you may continue:")
  16.         os.sleep(1)
  17.                 print("+---T-h-e-s-e--+--I-t-e-m-s---+")
  18.         os.sleep(.1)
  19.                 print("|  Block:40   |    Quarry:2   |")
  20.         os.sleep(.1)
  21.         print("|  RSCond: 4  | EnergyTess:6 |")
  22.         os.sleep(.1)
  23.                 print("|  GoldP: 6   |    Lamp:1    |")
  24.         os.sleep(.1)
  25.         print("|  EnderChest:|   DiamondP:1  |")
  26.         os.sleep(.1)
  27.         print("|  VoidPipe:1 |  SpotLoader:1 |")
  28.                 print("+----R----E----A----D----Y----+")
  29.         os.sleep(.5)
  30.         print("y/n?")
  31.                 print("")
  32.         end
  33. end
  34. local function fw(x)
  35.   for i = 1, x do
  36.     turtle.forward()
  37.   end
  38. end
  39.  
  40. local function back(x)
  41.   for i = 1, x do
  42.     turtle.back()
  43.   end
  44. end
  45. local function left(x)
  46.   for i = 1, x do
  47.     turtle.turnLeft()
  48.   end
  49. end
  50. local function right(x)
  51.   for i = 1, x do
  52.     turtle.turnRight()
  53.   end
  54. end
  55. local function up(x)
  56.   for i = 1, x do
  57.     turtle.up()
  58.   end
  59. end
  60.  
  61. local function down(x)
  62.   for i = 1, x do
  63.     turtle.down()
  64.   end
  65. end
  66.  
  67. local function pipe(x)
  68.   for i = 1, x do
  69.     turtle.place()
  70.     turtle.back()
  71.   end
  72. end
  73. local function unpipe(x)
  74.   for i = 1, x do
  75.     turtle.dig()
  76.     turtle.forward()
  77.   end
  78. end
  79. local function putD(x)
  80.   for i = 1, x do
  81.     turtle.placeDown()
  82.     turtle.forward()
  83.   end
  84. end
  85. local function getD(x)
  86.   for i = 1, x do
  87.     turtle.digDown()
  88.     turtle.forward()
  89.   end
  90. end
  91. local function stack(x)
  92.   for i = 1, x do
  93.     turtle.placeDown()
  94.     turtle.up()
  95.   end
  96. end
  97. local function unstack(x)
  98.   for i = 1, x do
  99.     turtle.down()
  100.     turtle.digDown()
  101.    
  102.   end
  103. end
  104. function stone()
  105. turtle.select(1)
  106. end
  107. function quarry()
  108. turtle.select(2)
  109. end
  110. function RSC()
  111. turtle.select(3)
  112. end
  113. function tess()
  114. turtle.select(4)
  115. end
  116. function gpipe()
  117. turtle.select(5)
  118. end
  119. function chest()
  120. turtle.select(7)
  121. end
  122. function dpipe()
  123. turtle.select(8)
  124. end
  125. function vpipe()
  126. turtle.select(9)
  127. end
  128. function chunk()
  129. turtle.select(10)
  130. end
  131. function lamp()
  132. turtle.select(6)
  133. end
  134.  
  135. function ring(x)
  136.     for i = 1, x do
  137.         stone()
  138.         putD(2)
  139.         right(1)
  140.         putD(1)
  141.         left(1)
  142.         putD(1)
  143.         right(1)
  144.         putD(1)
  145.         left(1)
  146.         putD(1)
  147.         right(1)
  148.         putD(2)
  149.        
  150.     end
  151. end
  152. function unring(x)
  153.     for i = 1, x do
  154.         stone()
  155.         getD(2)
  156.         right(1)
  157.         getD(1)
  158.         left(1)
  159.         getD(1)
  160.         right(1)
  161.         getD(1)
  162.         left(1)
  163.         getD(1)
  164.         right(1)
  165.         getD(2)
  166.         term.clear()
  167.         print('All Packed up!!! Do you want me to "move" to another location?')
  168.        
  169.     end
  170. end
  171. local function power(x)
  172.   for i = 1, x do
  173.         fw(1)
  174.         RSC()
  175.         putD(1)
  176.         right(1)
  177.         putD(1)
  178.         tess()
  179.         left(1)
  180.         putD(1)
  181.         right(1)
  182.         putD(1)
  183.         left(1)
  184.         putD(1)
  185.         left(1)
  186.         RSC()
  187.         fw(1)
  188.         putD(1)
  189.         left(1)
  190.         putD(1)
  191.         left(2)
  192.         putD(1)
  193.         right(1)
  194.         fw(2)
  195.         putD(2)
  196.            
  197.     end
  198. end
  199. local function bigpower(x)
  200.   for i = 1, x do
  201.         up(1)
  202.         right(1)
  203.         fw(1)
  204.         RSC()
  205.         putD(1)
  206.         right(1)
  207.         putD(1)
  208.         right(2)
  209.         tess()
  210.         putD(1)
  211.         fw(1)
  212.         right(2)
  213.         putD(1)
  214.         left(1)
  215.         fw(1)
  216.         putD(1)
  217.         lamp()
  218.         down(1)
  219.         stack(1)
  220.         chest()
  221.         putD(1)
  222.         tess()
  223.         putD(1)
  224.         RSC()
  225.         left(1)
  226.         putD(1)
  227.         left(2)
  228.         tess()
  229.         putD(1)
  230.         fw(1)
  231.         left(2)
  232.         putD(1)
  233.         right(1)
  234.         RSC()
  235.         fw(1)
  236.         putD(1)
  237.            
  238.     end
  239. end
  240. local function bigmarks(x)
  241.   for i = 1, x do
  242.         fw(1)
  243.         down(1)
  244.         stone()
  245.         left(1)
  246.         putD(1)
  247.         fw(30)
  248.         right(1)
  249.         putD(1)
  250.         fw(62)
  251.         right(2)
  252.         putD(1)
  253.         fw(62)
  254.         left(1)
  255.         fw(62)
  256.         right(2)
  257.         putD(1)
  258.         fw(30)
  259.         left(1)
  260.         fw(1)
  261.         up(2)
  262.         fw(9)
  263.         down(2)
  264.         stone()
  265.         left(1)
  266.         putD(1)
  267.         fw(30)
  268.         right(1)
  269.         putD(1)
  270.         fw(62)
  271.         right(2)
  272.         putD(1)
  273.         fw(62)
  274.         left(1)
  275.         fw(62)
  276.         right(2)
  277.         putD(1)
  278.         fw(30)
  279.         left(1)
  280.         fw(1)
  281.         up(2)
  282.         gpipe()
  283.         putD(4)
  284.         fw(1)
  285.        
  286.         putD(3)
  287.         right(2)
  288.         putD(1)
  289.         fw(3)
  290.         dpipe()
  291.         stack(1)
  292.         vpipe()
  293.         stack(1)
  294.         chunk()
  295.         stack(1)
  296.        
  297.         term.clear()
  298.         print("DONE!!!")
  299.        
  300.        
  301.            
  302.     end
  303. end
  304. local function unpower(x)
  305.   for i = 1, x do
  306.         fw(1)
  307.         RSC()
  308.         getD(1)
  309.         right(1)
  310.         getD(1)
  311.         tess()
  312.         left(1)
  313.         getD(1)
  314.         right(1)
  315.         getD(1)
  316.         left(1)
  317.         getD(1)
  318.         left(1)
  319.         RSC()
  320.         fw(1)
  321.         getD(1)
  322.         left(1)
  323.         getD(1)
  324.         left(2)
  325.         getD(1)
  326.         right(1)
  327.         fw(2)
  328.         getD(2)
  329.            
  330.     end
  331. end
  332. local function pipes(x)
  333.   for i = 1, x do
  334.         down(1)
  335.         quarry()
  336.         turtle.place()
  337.         up(1)
  338.         gpipe()
  339.         pipe(3)
  340.         turtle.place()
  341.         right(1)
  342.         fw(3)
  343.   end
  344. end
  345. local function unpipes(x)
  346.   for i = 1, x do
  347.     gpipe()
  348.         unpipe(3)
  349.     turtle.dig()
  350.     down(1)
  351.         quarry()
  352.         turtle.dig()
  353.         up(1)
  354.         back(3)
  355.         left(1)
  356.   end
  357. end
  358. local function finish(x)
  359.   for i = 1, x do
  360.     down(1)
  361.     lamp()
  362.     stack(1)
  363.     chest()
  364.     stack(1)
  365.     dpipe()
  366.     stack(1)
  367.     vpipe()
  368.     stack(1)
  369.     chunk()
  370.     stack(1)
  371.     print("All Done!!!")
  372.     term.clear()
  373.     print('When youre ready for me to "packup" or "move" to another location, just let me know!')
  374.   end
  375. end
  376. local function unfinish(x)
  377.   for i = 1, x do
  378.     chunk()
  379.     unstack(1)
  380.     vpipe()
  381.     unstack(1)
  382.     dpipe()
  383.     unstack(1)
  384.     chest()
  385.     unstack(1)
  386.     lamp()
  387.     unstack(1)
  388.     turtle.digDown()
  389.     turtle.digDown()
  390.     up(1)
  391.   end
  392. end
  393. local function newlocation(x)
  394.   for i = 1, x do
  395.     fw(16)
  396.     right(1)
  397.     fw(16)
  398.     left(1)
  399.   end
  400. end
  401. function choiceFunction()
  402.         if ready == true then
  403.                 choice = io.read()
  404.                 choice = string.lower(choice)                
  405.         if choice == "y" then
  406.                         bigbuild()
  407.                         choice = io.read()
  408.                         choice = string.lower(choice)
  409.                 end
  410.         if choice == "move" then
  411.                         move()
  412.                         choice = io.read()
  413.                         choice = string.lower(choice)
  414.                 end
  415.         if choice == "packup" then
  416.                         packup()
  417.                         choice = io.read()
  418.                         choice = string.lower(choice)
  419.                 end
  420.         if choice == "debug" then
  421.                         debugz()
  422.                         choice = io.read()
  423.                         choice = string.lower(choice)
  424.                 end
  425.         if choice == "big" then
  426.                         bigbuild()
  427.                         choice = io.read()
  428.                         choice = string.lower(choice)
  429.                 end
  430.     end
  431. end
  432. function ReadyFunction()
  433.     if (tgf > fuelLimit) then
  434.         ready = true
  435.     end
  436. end
  437. function build()
  438.     while true do
  439.         print("Im Working!!!")
  440.         os.sleep(.2)
  441.         print("Im Working!!!")
  442.         os.sleep(.2)
  443.         print("Im Working!!!")
  444.         os.sleep(1)
  445.         ring(4)
  446.         up(1)
  447.         power(4)
  448.         left(1)
  449.         back(1)
  450.         pipes(4)
  451.         finish(1)
  452.         break
  453.     end
  454. end
  455. function deploy()
  456.     up(5)
  457.     turtle.select(16)
  458.     turtle.placeUp()
  459.     turtle.select(1)
  460.     down(5)
  461. end
  462. function bigbuild()
  463.     while true do
  464.         deploy()
  465.         print("Im Working BigTime!!!")
  466.         os.sleep(.2)
  467.         print("Im Working!!!")
  468.         os.sleep(.2)
  469.         print("Im Working!!!")
  470.         os.sleep(1)
  471.         ring(4)
  472.         bigpower(1)
  473.         bigmarks(1)
  474.         break
  475.     end
  476. end
  477. function packup()
  478.     while true do
  479.         print("Im Packing Up!!!")
  480.         os.sleep(.2)
  481.         print("Im Packing Up!!!")
  482.         os.sleep(.2)
  483.         print("Im Packing Up!!!")
  484.         os.sleep(1)
  485.         unfinish(1)
  486.         unpipes(4)
  487.         fw(4)
  488.         right(1)
  489.         unpower(4)
  490.         down(1)
  491.         unring(4)
  492.         break
  493.     end
  494. end
  495. function move()
  496.     while true do
  497.         print("Im Moving!!!")
  498.         os.sleep(.2)
  499.         print("Im Moving!!!")
  500.         os.sleep(.2)
  501.         print("Im Moving!!!")
  502.         os.sleep(1)
  503.         unfinish(1)
  504.         unpipes(4)
  505.         fw(4)
  506.         right(1)
  507.         unpower(4)
  508.         down(1)
  509.         unring(4)
  510.         newlocation(1)
  511.         os.sleep(1)
  512.         ring(4)
  513.         up(1)
  514.         power(4)
  515.         left(1)
  516.         back(1)
  517.         pipes(4)
  518.         finish(1)
  519.         break
  520.     end
  521. end
  522.  
  523. function debugz()
  524.     while true do
  525.         print("FullDebugCommencing!")
  526.         os.sleep(.2)
  527.         print("FullDebugCommencing!")
  528.         os.sleep(.2)
  529.         print("FullDebugCommencing!")
  530.         os.sleep(1)
  531.         ring(4)
  532.         up(1)
  533.         power(4)
  534.         left(1)
  535.         back(1)
  536.         pipes(4)
  537.         finish(1)
  538.         os.sleep(1)
  539.         unfinish(1)
  540.         unpipes(4)
  541.         fw(4)
  542.         right(1)
  543.         unpower(4)
  544.         down(1)
  545.         unring(4)
  546.         newlocation(1)
  547.         os.sleep(1)
  548.         ring(4)
  549.         up(1)
  550.         power(4)
  551.         left(1)
  552.         back(1)
  553.         pipes(4)
  554.         finish(1)
  555.         os.sleep(1)
  556.         unfinish(1)
  557.         unpipes(4)
  558.         fw(4)
  559.         right(1)
  560.         unpower(4)
  561.         down(1)
  562.         unring(4)
  563.         term.clear()
  564.         print("Debug Done. Rebooting...")
  565.         os.reboot()
  566.     end
  567. end
  568. function main()
  569.     ReadyFunction()
  570.         if ready == true then
  571.              WriteMenu()
  572.              choiceFunction()
  573.         end
  574. end
  575.  
  576. main()
Advertisement
Add Comment
Please, Sign In to add comment