Wassaa

platform

Jan 10th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. local tArgs = {...}
  2. local length = tonumber(tArgs[1])
  3. local width = tonumber(tArgs[2])
  4. local turnRight = true
  5. local slot = 1
  6.  
  7. if width == nil then
  8.     print("1. Place turtle facing direction of said platform on left side.")
  9.     print("2. Load turtle with materials for the platform.")
  10.     print("3. Type 'platform <length> <width>'")
  11. end
  12.  
  13. turtle.select(slot)
  14.  
  15. turtle.dig()
  16. turtle.forward()
  17.  
  18. for j = 1, width, 1 do
  19.  
  20.   for i = 1, length, 1 do
  21.     if turtle.getItemCount(slot) == 0 then
  22.       slot = slot + 1
  23.       turtle.select(slot)
  24.       turtle.digDown()
  25.       turtle.placeDown()
  26.     else
  27.         turtle.digDown()
  28.       turtle.placeDown()
  29.     end
  30.    
  31.     if i < length then
  32.         turtle.dig()
  33.       turtle.forward()
  34.     end
  35.  
  36.   end
  37.  
  38.   if j < width then
  39.  
  40.     if turnRight == true then
  41.       turtle.turnRight()
  42.       turtle.dig()
  43.       turtle.forward()
  44.       turtle.turnRight()
  45.       turnRight = false
  46.     else
  47.       turtle.turnLeft()
  48.       turtle.dig()
  49.       turtle.forward()
  50.       turtle.turnLeft()
  51.       turnRight = true
  52.     end
  53.    
  54.   end
  55.  
  56. end
Add Comment
Please, Sign In to add comment