SHOW:
|
|
- or go back to the newest paste.
| 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 | - | turtle.placeDown() |
| 21 | + | |
| 22 | ||
| 23 | print("How tall (On the inside) do you want it? ")
| |
| 24 | ||
| 25 | sqrTall = read() | |
| 26 | ||
| 27 | --Functions | |
| 28 | - | turtle.placeDown() |
| 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 | - | turtle.placeDown() |
| 38 | + | |
| 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 | - | --print(isEven) |
| 51 | + | |
| 52 | - | --Test for isEven ^ |
| 52 | + | |
| 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 | - | for i = 1,4 do |
| 71 | + | |
| 72 | ||
| 73 | --Build the walls of the structure | |
| 74 | - | turtle.up() |
| 74 | + | |
| 75 | function bldWall() | |
| 76 | - | end |
| 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 | - | while true do |
| 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 | - | matSlot() |
| 95 | + | |
| 96 | ||
| 97 | --Variables | |
| 98 | ||
| 99 | - | matSlot() |
| 99 | + | |
| 100 | isEven = true | |
| 101 | else | |
| 102 | - | matSlot() |
| 102 | + | |
| 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() |