Fadamaka

enterier

Sep 20th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. local function goTillWall()
  2.     while turtle.detect()==false do
  3.         turtle.forward()
  4.     end
  5. end
  6.  
  7. local function goTillFloor()
  8.     while turtle.detectDown()==false do
  9.         turtle.down()
  10.     end
  11. end
  12.  
  13. local function countDistance()
  14.     local count=1
  15.     while turtle.detect()==false do
  16.         turtle.forward()
  17.         count=count+1
  18.     end
  19.     return count
  20. end
  21.  
  22. local function countHeight()
  23.     local count=1
  24.     while turtle.detectUp()==false do
  25.         turtle.up()
  26.         count=count+1
  27.     end
  28.     return count
  29. end
  30.  
  31. local function getInvCount()
  32.     local itemCount=0
  33.     local slot=1
  34.     while slot<=16 do
  35.         turtle.select(slot)
  36.         itemCount=itemCount+turtle.getItemCount()
  37.         slot=slot+1
  38.     end
  39.     return itemCount
  40. end
  41.  
  42. goTillWall()
  43. turtle.turnLeft()
  44. goTillWall()
  45. turtle.turnLeft()
  46. local x=0
  47. local z=0
  48. local y=0
  49.  
  50. x=countDistance()
  51. turtle.turnLeft()
  52. z=countDistance()
  53. goTillFloor()
  54. y=countHeight()
  55.  
  56. print("Your room's dimension is the following x:",x," z:",z," y:",y)
  57. print("\nPut ",x*y*2+x*z*2+z*y*2, " blocks inside me and press enter, if the amount of blocks doesn't fit at once. I' ll stop when I ran out.")
  58. read()
  59.  
  60. local blocks=0
  61. blocks=getInvCount()
  62. print("\n Blocks inside:",blocks)
  63. read()
Add Comment
Please, Sign In to add comment