SHOW:
|
|
- or go back to the newest paste.
| 1 | -- ######################### | |
| 2 | -- # Torches, Chest, Empty # | |
| 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 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <-- HJÄLP | |
| 24 | if ( rows ~= 0 ) then | |
| 25 | for i=1, rows do | |
| 26 | ||
| 27 | turtle.dig() | |
| 28 | turtle.forward() | |
| 29 | turtle.digUp() | |
| 30 | end | |
| 31 | Just nu måste man skriva 30 för att den ska göra detta 40 gånger, jag vill att den ALLTID ska göra detta 40 gånger, och att man bara väljer hur många gånger den ska köra det. Tex; 2, då kör det detta 2 gånger vilket menas med att den kör 40 blocks fram, går tillbaks, 3 blocks åt vänster gör samma sak. Den ska branch mina. | |
| 32 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 33 | ||
| 34 | -- ################## | |
| 35 | - | turtle.select(16) |
| 35 | + | |
| 36 | - | turtle.getItemCount() |
| 36 | + | |
| 37 | - | if turtle.getItemCount > 0 then |
| 37 | + | turtle.getItemCount(16) |
| 38 | - | turtle.select(14) |
| 38 | + | if turtle.getItemCount > 0 then |
| 39 | - | turtle.place() |
| 39 | + | turtle.select(14) |
| 40 | - | turtle.select(1) |
| 40 | + | turtle.place() |
| 41 | - | turtle.drop() |
| 41 | + | turtle.select(1) |
| 42 | - | turtle.select(2) |
| 42 | + | turtle.drop() |
| 43 | - | turtle.drop() |
| 43 | + | turtle.select(2) |
| 44 | - | turtle.select(3) |
| 44 | + | turtle.drop() |
| 45 | - | turtle.drop() |
| 45 | + | turtle.select(3) |
| 46 | - | turtle.select(4) |
| 46 | + | turtle.drop() |
| 47 | - | turtle.drop() |
| 47 | + | turtle.select(4) |
| 48 | - | turtle.select(5) |
| 48 | + | turtle.drop() |
| 49 | - | turtle.drop() |
| 49 | + | turtle.select(5) |
| 50 | - | turtle.select(6) |
| 50 | + | turtle.drop() |
| 51 | - | turtle.drop() |
| 51 | + | turtle.select(6) |
| 52 | - | turtle.select(14) |
| 52 | + | turtle.drop() |
| 53 | - | turtle.dig() |
| 53 | + | turtle.select(7) |
| 54 | turtle.drop() | |
| 55 | turtle.select(8) | |
| 56 | turtle.drop() | |
| 57 | turtle.select(9) | |
| 58 | turtle.drop() | |
| 59 | turtle.select(10) | |
| 60 | turtle.drop() | |
| 61 | turtle.select(11) | |
| 62 | turtle.drop() | |
| 63 | turtle.select(12) | |
| 64 | turtle.drop() | |
| 65 | turtle.select(13) | |
| 66 | turtle.drop() | |
| 67 | turtle.select(14) | |
| 68 | turtle.dig() | |
| 69 | end | |
| 70 | else | |
| 71 | turtle.select(15) | |
| 72 | end | |
| 73 | - | turtle.turnLeft() |
| 73 | + | |
| 74 | - | turtle.forward() |
| 74 | + | |
| 75 | - | turtle.digUp() |
| 75 | + | |
| 76 | - | turtle.digDown() |
| 76 | + | |
| 77 | - | turtle.forward() |
| 77 | + | |
| 78 | - | turtle.digUp() |
| 78 | + | |
| 79 | - | turtle.digDown() |
| 79 | + | |
| 80 | - | turtle.forward() |
| 80 | + | |
| 81 | - | turtle.digUp() |
| 81 | + | |
| 82 | - | turtle.digDown() |
| 82 | + | |
| 83 | - | turtle.turnRight() |
| 83 | + | |
| 84 | ||
| 85 | -- ###################### | |
| 86 | -- # Starting a new row # | |
| 87 | -- ###################### | |
| 88 | turtle.turnLeft() | |
| 89 | turtle.dig() | |
| 90 | turtle.forward() | |
| 91 | turtle.digUp() | |
| 92 | turtle.dig() | |
| 93 | turtle.forward() | |
| 94 | turtle.digUp() | |
| 95 | turtle.dig() | |
| 96 | turtle.forward() | |
| 97 | turtle.turnRight() | |
| 98 | end |