print("How far?")
dist= (read())
for i = 1, dist do
turtle.up()
turtle.up()
turtle.up()
turtle.dig()
turtle.forward()
turtle.digDown()
turtle.down()
turtle.digDown()
turtle.down()
turtle.digDown()
turtle.down()
turtle.digDown()
turtle.down()
end
How do I use this?!?!
Save the code, to do this:
1. Right-click on the turtle.
2. Type: edit stairs – This will edit the file "stairs" (Lua is case sensitive!!) and create the file if it doesn't exist.
3. Type the code in line by line.
4. Press "Ctrl" and save the file, and then exit.
5. On the main screen, type "stairs" to run the stairs program you just created. It will ask you: "How far?" and then you can input how far you would like the turtle to mine, and press ENTER.
Now, what does it do?
Firstly, it prints "How far?", and then reads the input and sets it as dist. Now, if you left it as:
read()
it would read it as a string, hence the other brackets. for i = 1, dist do
Tells the computer that every i = +1, and it will do until i reaches dist, which we set when it reads the input.Sorry if that was a bad explanation, but I tried >.<.
You can download the .txt with the code, but it wont allow me to upload the actual file.. :/