Guest User

Quarry

a guest
Nov 20th, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.21 KB | None | 0 0
  1. function CleanClear()
  2.   term.clear()
  3.   term.setCursorPos(1, 1)
  4. end
  5.  
  6. function Confirm(xD, zD, dep, retFq)
  7.   CleanClear()
  8.   textutils.slowPrint("So...")
  9.   sleep(2)
  10.   CleanClear()
  11.   textutils.slowPrint("Quarry Parameter Preview\n")
  12.   print("Quarry X: "..xD)
  13.   print("Quarry Z: "..zD)
  14.   print("Quarry depth: "..dep)
  15.   print("Quarry return frequency: "..retFq.."\n")
  16.   sleep(2)
  17.   print("Is this correct?")
  18.   textutils.slowPrint("Y for yes or anything else for no...")
  19.   confirmEnter = read()
  20.  
  21.    if confirmEnter ~= "Y" then
  22.     CleanClear()
  23.     print("Okay... Restarting program.")
  24.     sleep(1)
  25.     Start()
  26.   else
  27.     CleanClear()
  28.     textutils.slowPrint("Quarry Fuel Preview\n")
  29.     local amOfFuelIn = turtle.getFuelLevel()
  30.     if amOfFuelIn <= 0 then
  31.       print("It seems that there is no fuel left in QuarryBot. In order to continue, enter the amount of items of fuel you want to load in or enter \'all\' to load QuarryBot with all the fuel within its inventory. If you don't use \'all\' then it will only take fuel from the top-left slot.\n")
  32.       local fuelParamEnter = read()
  33.       if fuelParamEnter == "all" then    
  34.         for i = 1, 16 do
  35.           turtle.select(i)
  36.           if turtle.refuel(0) then
  37.             turtle.refuel(turtle.getItemCount(i))
  38.           end
  39.         end
  40.         turtle.select(1)
  41.       else
  42.         turtle.select(1)
  43.         if(turtle.refuel(0)) then
  44.           turtle.refuel(tonumber(fuelParamEnter))
  45.         end
  46.       end
  47.       print("Refueled!\n")
  48.       print("There is now "..turtle.getFuelLevel().." fuel inside of QuarryBot.")
  49.    end  
  50. end
  51. end
  52.  
  53. function Start()
  54.   CleanClear()
  55.   textutils.slowPrint("Welcome to Quarry")
  56.   sleep(2)
  57.   print("How far on the X-Axis do you want to quarry?")
  58.   local xDist = tonumber(read())
  59.   sleep(1)
  60.   print("How far on the Z-Axis do you want to quarry?")
  61.   local zDist = tonumber(read())
  62.   sleep(1)
  63.   print("How deep would you like to quarry?")
  64.   local depth = tonumber(read())
  65.   sleep(1)
  66.   print("How often would you like the QuarryBot to return to the surface?")
  67.   print("(Per the amount of blocks the quarry mines.)")
  68.   local returnFreq = tonumber(read())
  69.   sleep(2)
  70.   Confirm(xDist, zDist, depth, returnFreq)
  71. end
  72.  
  73. Start()
Advertisement
Add Comment
Please, Sign In to add comment