SHOW:
|
|
- or go back to the newest paste.
| 1 | -- ######################### | |
| 2 | -- # Torches, Chest, Empty # | |
| 3 | -- ######################### | |
| 4 | - | invT = 8 |
| 4 | + | -- # Torches = 15 # |
| 5 | - | invC = 7 |
| 5 | + | -- # Chest = 14 # |
| 6 | - | invE = 9 |
| 6 | + | |
| 7 | ||
| 8 | print("Starting branch-program")
| |
| 9 | print("Please place your turtle like this:")
| |
| 10 | print(" # # # ")
| |
| 11 | print(" # # # ")
| |
| 12 | print(" # T # ")
| |
| 13 | print("When ready, press start")
| |
| 14 | ||
| 15 | local message = io.read() | |
| 16 | ||
| 17 | - | if ( message == "branchmine" ) then |
| 17 | + | if ( message == "start" ) then |
| 18 | print("How many rows?")
| |
| 19 | message = io.read() | |
| 20 | ||
| 21 | rows = tonumber( message ) | |
| 22 | end | |
| 23 | ||
| 24 | if ( rows ~= 0 ) then | |
| 25 | for i=1, rows do | |
| 26 | ||
| 27 | turtle.dig() | |
| 28 | turtle.forward() | |
| 29 | turtle.digUp() | |
| 30 | end | |
| 31 | ||
| 32 | -- ################## | |
| 33 | -- # Full inventory # | |
| 34 | -- ################## | |
| 35 | - | turtle.select(invE) |
| 35 | + | turtle.select(16) |
| 36 | - | if turtle.getItemCount > 0 then |
| 36 | + | turtle.getItemCount() |
| 37 | - | turtle.select(invC) |
| 37 | + | if turtle.getItemCount > 0 then |
| 38 | turtle.select(14) | |
| 39 | - | turtle.select(1) |
| 39 | + | turtle.place() |
| 40 | - | turtle.drop() |
| 40 | + | turtle.select(1) |
| 41 | - | turtle.select(2) |
| 41 | + | turtle.drop() |
| 42 | - | turtle.drop() |
| 42 | + | turtle.select(2) |
| 43 | - | turtle.select(3) |
| 43 | + | turtle.drop() |
| 44 | - | turtle.drop() |
| 44 | + | turtle.select(3) |
| 45 | - | turtle.select(4) |
| 45 | + | turtle.drop() |
| 46 | - | turtle.drop() |
| 46 | + | turtle.select(4) |
| 47 | - | turtle.select(5) |
| 47 | + | turtle.drop() |
| 48 | - | turtle.drop() |
| 48 | + | turtle.select(5) |
| 49 | - | turtle.select(6) |
| 49 | + | turtle.drop() |
| 50 | - | turtle.drop() |
| 50 | + | turtle.select(6) |
| 51 | - | turtle.select(invC) |
| 51 | + | turtle.drop() |
| 52 | turtle.select(14) | |
| 53 | turtle.dig() | |
| 54 | end | |
| 55 | - | turtle.select(invT) |
| 55 | + | |
| 56 | turtle.select(15) | |
| 57 | end | |
| 58 | -- ########################### | |
| 59 | -- # Return, placing torches # | |
| 60 | - | turtle.select(invT) |
| 60 | + | |
| 61 | turtle.select(15) | |
| 62 | ||
| 63 | for i=1, rows do | |
| 64 | turtle.back() | |
| 65 | ||
| 66 | if i % 6 == 0 then | |
| 67 | turtle.place() | |
| 68 | end | |
| 69 | ||
| 70 | -- ###################### | |
| 71 | -- # Starting a new row # | |
| 72 | -- ###################### | |
| 73 | - | turtle.forward() |
| 73 | + | |
| 74 | - | turtle.digUp() |
| 74 | + | turtle.forward() |
| 75 | - | turtle.digDown() |
| 75 | + | turtle.digUp() |
| 76 | - | turtle.forward() |
| 76 | + | turtle.digDown() |
| 77 | - | turtle.digUp() |
| 77 | + | turtle.forward() |
| 78 | - | turtle.digDown() |
| 78 | + | turtle.digUp() |
| 79 | - | turtle.forward() |
| 79 | + | turtle.digDown() |
| 80 | - | turtle.digUp() |
| 80 | + | turtle.forward() |
| 81 | - | turtle.digDown() |
| 81 | + | turtle.digUp() |
| 82 | - | turtle.turnRight() |
| 82 | + | turtle.digDown() |
| 83 | turtle.turnRight() | |
| 84 | end |