M0n5t3r

Wall

Jun 29th, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1.  
  2. input = {...}
  3. wallLength = tonumber(input[1])
  4. wallHeight = tonumber(input[2])
  5.  
  6. -- The starting slot to look for building materials (from left to right, top to bottem)
  7. --ie. 1 2 3
  8. -- 4 5 6
  9. -- 7 8 9
  10. currentSlot = 1
  11.  
  12. -- This is a function, it is peice of script that we will run later.
  13. -- If this inventory slot runs out of building blocks, move to the next slot.
  14. function gotoNextSlotIfEmpty()
  15. if turtle.getItemCount(currentSlot) == 0 then
  16. currentSlot = currentSlot + 1
  17. turtle.select(currentSlot)
  18. end
  19. end
  20.  
  21. -- This is where the code starts running.
  22. turtle.select(currentSlot)
  23. turtle.up()
  24.  
  25. for height = 1, wallHeight do
  26.  
  27. for length = 1, wallLength do
  28. turtle.placeDown()
  29. gotoNextSlotIfEmpty() -- This call runs the function above, functions must be placed above where they are used.
  30. if length ~= wallLength then -- ~= means 'not equal'
  31. turtle.forward()
  32. end
  33. end
  34.  
  35. if height ~= wallHeight then
  36. turtle.turnRight()
  37. turtle.turnRight()
  38. turtle.up()
  39. end
  40. end
Add Comment
Please, Sign In to add comment