Advertisement
Guest User

Room.lua

a guest
Feb 23rd, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.98 KB | None | 0 0
  1. -- This program will carve out a square room
  2. -- of dimensions specified.
  3.  
  4. io.write("Height: ")
  5. height = io.read()
  6. io.write("Width: ")
  7. width = io.read()
  8. io.write("Depth: ")
  9. depth = io.read()
  10.  
  11. function dig()
  12.     while turtle.detect() do
  13.         turtle.dig()
  14.     end
  15.     turtle.forward()
  16. end
  17.  
  18. function  wline(param)
  19.     for i=1, param do
  20.         dig()
  21.     end
  22.     turtle.turnLeft()
  23.     turtle.turnLeft()
  24.     for i =1, param do
  25.         turtle.forward()
  26.     end
  27.     turtle.turnRight()
  28. end
  29.  
  30. function tall(param1,param2)
  31.     for i=1,param1-1 do
  32.         wline(param2-1)
  33.         turtle.digUp()
  34.         turtle.up()
  35.         turtle.turnRight()
  36.     end
  37.     wline(param2-1)
  38.     for i=1, param1-1 do
  39.         turtle.down()
  40.     end
  41. end
  42.  
  43. function deep(parama1,parama2,parama3)
  44.     for i=1,parama1 do
  45.         turtle.dig()
  46.         turtle.forward()
  47.         turtle.turnRight()
  48.         tall(parama2,parama3)
  49.     end
  50. end
  51.  
  52. deep(depth,height,width)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement