jcoutie

skyscraper windows

Jan 22nd, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.62 KB | None | 0 0
  1. -- Variables
  2.  
  3. turtle.select(1)
  4. height = 0
  5. local tArgs = { ... }
  6. local levelAlt = tonumber(tArgs[1])
  7.  
  8. -- Functions
  9.  
  10. local function tMove(distance)
  11.   for i=1,distance do
  12.     while turtle.forward() == false do
  13.       turtle.dig()
  14.       turtle.attack()
  15.       sleep(0.5)
  16.     end
  17.   end
  18. end
  19.  
  20. local function tDescend(distance)
  21.   for i=1,distance do
  22.     while turtle.down() == false do
  23.       turtle.digDown()
  24.       turtle.attackDown()
  25.       sleep(0.5)
  26.     end
  27.   end
  28. end
  29.  
  30. local function tAscend(distance)
  31.   for i=1,distance do
  32.     while turtle.up() == false do
  33.       turtle.digUp()
  34.       turtle.attackUp()
  35.       sleep(0.5)
  36.     end
  37.   end
  38. end
  39.  
  40. local function turnaround()
  41.   turtle.turnRight()
  42.   turtle.turnRight()
  43. end
  44.  
  45. local function windowStrip()
  46. for j=1,4 do
  47.  tMove(2)
  48.  turtle.turnLeft()
  49.  tMove(1)
  50.  turtle.turnRight()
  51.  tMove(3)
  52.  turnaround()
  53.  tMove(2)
  54.  for i=1,4 do
  55.   turtle.place()
  56.   turtle.back()
  57.  end
  58.  tMove(1)
  59.  turtle.turnLeft()
  60.  tMove(1)
  61.  turtle.turnRight()
  62.  tMove(1)
  63.  turtle.turnLeft()
  64.  tMove(2)
  65.  turnaround()
  66.  tMove(1)
  67.  turtle.place()
  68.  turtle.back()
  69.  turtle.place()
  70.  turtle.turnRight()
  71.  turtle.back()
  72.  turtle.place()
  73.  turtle.turnRight()
  74.  tMove(2)
  75. end
  76. end
  77.  
  78. -- Startup
  79.  
  80.  term.clear()
  81.  term.setCursorPos(1,1)
  82.  print("Please place blocks as follows:")
  83.  print("Slot 1 - Glass Panes (56)")
  84.  print()
  85.  print("Ground Level = 0")
  86.  print("Press enter a level when ready:")
  87.  level = read(input)
  88.  
  89. -- Main Program
  90. tAscend(4*level)
  91. tMove(2)
  92. turtle.turnLeft()
  93. windowStrip()
  94. tAscend(1)
  95. windowStrip()
  96. tDescend(1)
  97. turtle.turnLeft()
  98. tMove(2)
  99. tDescend(4*level)
  100. turnaround()
Advertisement
Add Comment
Please, Sign In to add comment