JoshuaKade

pltfrm v0.6

Jun 16th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Prompt
  2.  
  3. term.clear()
  4. term.setCursorPos(1,1)
  5. print("+-------------------------------------+")
  6. print("|  Please place fuel in the lower-    |")
  7. print("|  right slot.                        |")
  8. print("|  Place building materials in the    |")
  9. print("|  remaining slots.                   |")
  10. print("+-------------------------------------+")
  11. sleep(1)
  12. print("How big of a square do you want? ")
  13.  
  14. sqrSize = read()
  15.  
  16. function placeDown()
  17.   if turtle.placeDown() == false then
  18.     checkSlot()
  19.   end
  20.   turtle.placeDown()
  21. end
  22.  
  23. print("How tall (On the inside) do you want it? ")
  24.  
  25. sqrTall = read()
  26.  
  27. --Functions
  28.  
  29. function plcColumn()
  30.   for i = 1, sqrSize do
  31.     placeDown()
  32.     turtle.forward()
  33.   end
  34. end
  35.  
  36. --Even Column Placement
  37.  
  38. function aa()
  39.     plcColumn()
  40.     turtle.turnLeft()
  41.     turtle.forward()
  42.     turtle.turnLeft()
  43.     turtle.forward()
  44. end
  45.  
  46. --Odd Column Placement
  47.  
  48. function ab()
  49.     plcColumn()
  50.     turtle.turnRight()
  51.     turtle.forward()
  52.     turtle.turnRight()
  53.     turtle.forward()
  54. end
  55.  
  56. --Build a square Platform
  57.  
  58. function fltSqr()
  59.   if isEven == true then
  60.     for i = 1, sqrSize/2 do
  61.       aa()
  62.       ab()
  63.     end
  64.   else
  65.     for i = 1, sqrSize/2 do
  66.       aa()
  67.       ab()
  68.     end
  69.     aa()
  70.   end
  71. end
  72.  
  73. --Build the walls of the structure
  74.  
  75. function bldWall()
  76.   for i = 1, 4 do
  77.       for i = 1, sqrSize do
  78.           placeDown()
  79.           turtle.forward()
  80.       end
  81.       turtle.turnLeft()
  82.   end
  83. turtle.up()
  84. end
  85.  
  86. --Change slot selection when you run out of materials
  87.  
  88. function checkSlot()
  89.   for i = 1, 15 do
  90.       if itemCount == 0 then
  91.         slotNum = slotNum + 1
  92.         turtle.select(slotNum)
  93.       end
  94.   end
  95. end
  96.  
  97. --Variables
  98.  
  99. if sqrSize %2 == 0 then
  100.   isEven = true
  101. else
  102.   isEven = false
  103. end
  104.  
  105. slotNum = 1
  106.  
  107. itemCount = turtle.getItemCount(slotNum)
  108.  
  109.  
  110. --Tests for Variables (Comment out to disable)
  111. print(isEven)
  112. print(slotNum)
  113. print(itemCount)
  114.  
  115. --The actual build program
  116.  
  117. fltSqr()
  118. turtle.turnRight(2)
  119. turtle.forward()
  120. turtle.up()
  121. for i = 1, sqrTall do
  122.   bldWall()
  123. end
  124. fltSqr()
Advertisement
Add Comment
Please, Sign In to add comment