dadragon84

Turtle Stairs

Jul 2nd, 2013 (edited)
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.21 KB | None | 0 0
  1. version = 2.1
  2. term.clear()
  3. term.setCursorPos(1,1)
  4. print("Welcome to Mr John Dowe's \n Stair Creator version " .. version .. "\n\n")
  5. recursions = 1
  6.  
  7. function checkFuel()
  8.     if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 1 then
  9.         turtle.select(1)
  10.         if turtle.getItemCount( turtle.getSelectedSlot() ) > 0 then
  11.             print("Refuelling")
  12.             turtle.refuel()
  13.             return
  14.         else
  15.             print("I'm out of fuel in slot 1.")
  16.             checkFuel()
  17.         end
  18.    
  19.     end
  20. end
  21.  
  22. checkFuel()
  23.  
  24. print("Please Tell me how far down you want the stairs to go?")
  25. depth = read()
  26. term.clear()
  27. term.setCursorPos(1,1)
  28. print("Do you want to place torches: Yes/No")
  29. print("Please place torches in slot 16")
  30. torches = read()
  31. torches = tostring(torches)
  32. torches = string.lower(torches)
  33. term.clear()
  34. term.setCursorPos(1,1)
  35. print("Would you like me to place stairs?: Yes/No")
  36. print("Place stairs in slot 2")
  37. stairsPlacement = read()
  38. stairsPlacement = tostring(stairsPlacement)
  39. stairsPlacement = string.lower(stairsPlacement)
  40. term.clear()
  41. term.setCursorPos(1,1)
  42. print("Creating Stairs Going Down")
  43.  
  44. for i=1,depth do
  45.        
  46.         if(stairsPlacement == "yes") then
  47.        
  48.             turtle.digDown()
  49.             turtle.down()
  50.             turtle.turnLeft()
  51.             turtle.turnLeft()
  52.             turtle.dig()
  53.             turtle.select(2)
  54.             turtle.place()
  55.             turtle.turnRight()
  56.             turtle.turnRight()
  57.            
  58.         else
  59.             turtle.digDown()
  60.             turtle.down()
  61.         end
  62.            
  63.         for i=1,4 do
  64.                 if i == 4 then 
  65.                    
  66.                         turtle.turnLeft()
  67.                         turtle.dig()
  68.                         turtle.turnRight()
  69.                         turtle.turnRight()
  70.                         turtle.dig()
  71.                         turtle.turnLeft()
  72.                         turtle.back()
  73.                    
  74.                    
  75.                    
  76.                     if (recursions % 5 == 0) and (torches == "yes") then
  77.                             turtle.select(16)
  78.                             turtle.place()
  79.                             turtle.back()
  80.                     else
  81.                             turtle.back()
  82.                     end
  83.                 else
  84.    
  85.                     turtle.turnLeft()
  86.                     turtle.dig()
  87.                     turtle.turnRight()
  88.                     turtle.turnRight()
  89.                     turtle.dig()
  90.                     turtle.turnLeft()
  91.                     turtle.dig()
  92.                     turtle.forward()
  93.                    
  94.                 end
  95.                 recursions = recursions + 1
  96.         end
  97. end
  98. term.clear()
  99. term.setCursorPos(1,1)
  100. print("Stairs are Complete")
  101.  
Advertisement
Add Comment
Please, Sign In to add comment