JoshuaKade

pltfrm v0.7

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