SHOW:
|
|
- or go back to the newest paste.
| 1 | -- ################## | |
| 2 | -- # Torches, Chest # | |
| 3 | -- ################## | |
| 4 | -- # Torches = 15 # | |
| 5 | -- # Chest = 14 # | |
| 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 == "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 | -- # Branches # | |
| 26 | for z=1, rows do | |
| 27 | -- # Dig this branch # | |
| 28 | for x=1, 40 do | |
| 29 | turtle.dig() | |
| 30 | turtle.forward() | |
| 31 | turtle.digUp() | |
| 32 | end | |
| 33 | ||
| 34 | -- # Full inventory # | |
| 35 | if turtle.getItemCount( 14 ) > 0 then | |
| 36 | turtle.select(16) | |
| 37 | turtle.place() | |
| 38 | ||
| 39 | for i=1, 14 do | |
| 40 | turtle.select( i ) | |
| 41 | turtle.drop() | |
| 42 | end | |
| 43 | ||
| 44 | turtle.dig() | |
| 45 | end | |
| 46 | ||
| 47 | -- # Return, placing torches # | |
| 48 | turtle.select(15) | |
| 49 | ||
| 50 | - | for i=1, rows do |
| 50 | + | for i=1, 40 do |
| 51 | turtle.back() | |
| 52 | ||
| 53 | if i % 6 == 0 then | |
| 54 | turtle.place() | |
| 55 | end | |
| 56 | end | |
| 57 | ||
| 58 | -- # Starting a new row # | |
| 59 | turtle.turnLeft() | |
| 60 | turtle.dig() | |
| 61 | turtle.forward() | |
| 62 | turtle.digUp() | |
| 63 | turtle.dig() | |
| 64 | turtle.forward() | |
| 65 | turtle.digUp() | |
| 66 | turtle.dig() | |
| 67 | turtle.forward() | |
| 68 | turtle.turnRight() | |
| 69 | end | |
| 70 | end |