Advertisement
Nehulol

digStair

Dec 12th, 2024 (edited)
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. -- Function to build stairs by breaking blocks
  2. function buildStairs(stairSize)
  3.     -- Loop through the stair size and break the blocks for the stairs
  4.     for i = 1, stairSize do
  5.         -- Break the block in front of the turtle
  6.         turtle.dig()  -- Break the block in front of the turtle
  7.        
  8.         -- Move forward to create the next step
  9.         turtle.forward()
  10.  
  11.         turtle.digUp()
  12.        
  13.         -- Break the block below the turtle (creating a descending stair)
  14.         turtle.digDown()  -- Break the block below the turtle
  15.        
  16.         -- Move down a block to continue the stair effect
  17.         turtle.down()
  18.     end
  19. end
  20.  
  21. -- Ask user for stair size (how long the stairs will be)
  22. print("Enter the stair size (number of steps):")
  23. local stairSize = tonumber(read())
  24.  
  25. -- Build the stairs by breaking blocks with the specified size
  26. buildStairs(stairSize)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement