Advertisement
massacring

DigStaircase

Jul 19th, 2024 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. local MiningLib = require('MassaMiningTurtleLib')
  2.  
  3. local function tutorial()
  4.     print("How to use the DigStaircase script.")
  5.     print("")
  6.     print("[] means required.")
  7.     print("<> means optional.")
  8.     print("")
  9.     print("DigStaircase [depth: number] <direction: up or down>")
  10.     print("")
  11.     print("Example command:")
  12.     print("'DigStaircase 10'")
  13.     print("This will dig a staircase downwards 10 blocks.")
  14. end
  15.  
  16. local function staircase(direction, depth)
  17.     for x = 1, depth, 1 do
  18.         turtle.digDown()
  19.         MiningLib.digAndMoveForward()
  20.         if (direction == "up") then MiningLib.digAndMoveUp()
  21.         else MiningLib.digAndMoveDown() end
  22.     end
  23. end
  24.  
  25. local function init()
  26.     if arg[1] == "help" then return true end
  27.     local depth = tonumber(arg[1]) or error("Requires number argument", 0)
  28.     local direction = arg[2]
  29.  
  30.     staircase(direction, depth)
  31. end
  32.  
  33. local guide = init()
  34. if guide then tutorial() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement