Difference between revisions of "Turtle Tutorial"

From ComputerCraft Wiki
Jump to: navigation, search
(→‎Turtle)
(wOFEneqrrKsRf)
Line 1: Line 1:
−
[[Category:Tutorials]]
+
Děkuji za připomednku, topened je skutečně proble9m  nelze vyte1pět jen tu jednu medstnost, mused se vytopit cele1 solkoovna a to stojed moc peněz. Minule (3.11.) jsem přinesla z domova ještě jedny el. kamna a bylo tam tepledčko po celou dobu, protože topedm už od 6.45 hod. Takže topit budeme samostatně do doby, než začnou mrazy a solkoovna bude vyte1pěna cele1. Pan spre1vce nabeddl, že ne1m přinese dalšed kamna (svoje vlastned), abychom tento proble9m vyřešili.
−
This tutorial will teach you the functions of the Turtle API, and also will teach you how to make your first turtle program.
+
−
 
+
−
== Turtle ==
+
−
 
+
−
The Turtle API is used to work with your Turtles.
+
−
[[Turtle (API)|Here is a list of the complete Turtle API]]
+
−
 
+
−
For our program, we will use turtle.detectDown(), turtle.digDown(), turtle.down() and turtle.forward(). It is recommended that you learn what method does what before messing with Turtles.
+
−
 
+
−
== The Program ==
+
−
So, for you to make the Turtle program, first craft a Turtle.
+
−
 
+
−
{{Crafting grid
+
−
|A1=iron_ingot |B1=iron_ingot    |C1=iron_ingot
+
−
|A2=iron_ingot |B2=console      |C2=iron_ingot
+
−
|A3=iron_ingot |B3=chest        |C3=iron_ingot
+
−
|Output=turtle
+
−
}}
+
−
 
+
−
Then make a Mining Turtle.
+
−
 
+
−
{{Crafting grid
+
−
|A2=turtle |B2=diamond_pickaxe
+
−
|Output=mining_turtle
+
−
}}
+
−
 
+
−
 
+
−
Then, place it anywhere you want. Right click it and type 'edit MyFirstTurtleProgram'. You don't have to call it 'MyFirstTurtleProgram'; It can be whatever you want.
+
−
So, inside the file, type:
+
−
while turtle.detectDown() do
+
−
print("Digging down!")
+
−
turtle.digDown()
+
−
print("Going down!")
+
−
turtle.down()
+
−
print("Digging forward!")
+
−
turtle.dig()
+
−
print("Going forward!")
+
−
turtle.forward()
+
−
end
+
−
 
+
−
To save the program, press CTRL and select SAVE with the Arrow Keys. After that, type MyFirstTurtleProgram (or whatever you called your program).
+
−
 
+
−
If you want a spiral drill formation that allows you to be able to retrieve the turtle after its done mining, do the same as above but when editing the program type:
+
−
while turtle.detectDown() do
+
−
turtle.dig()
+
−
turtle.digDown()
+
−
turtle.down()
+
−
turtle.dig()
+
−
turtle.forward()
+
−
turtle.turnLeft()
+
−
end
+
−
 
+
−
== Explanation ==
+
−
 
+
−
The line while turtle.detectDown() do makes the program run until there is no block underneath the Turtle.
+
−
 
+
−
The turtle.digDown() will make the Turtle dig down.
+
−
 
+
−
The part where it says turtle.forward() will make the Turtle go forward.
+
−
 
+
−
The line that says turtle.dig() will make the Turtle dig forward.
+
−
 
+
−
 
+
−
NOTE: this should be running on a mining turtle, or it wont work!
+

Revision as of 03:22, 21 September 2012

Děkuji za připomednku, topened je skutečně proble9m nelze vyte1pět jen tu jednu medstnost, mused se vytopit cele1 solkoovna a to stojed moc peněz. Minule (3.11.) jsem přinesla z domova ještě jedny el. kamna a bylo tam tepledčko po celou dobu, protože topedm už od 6.45 hod. Takže topit budeme samostatně do doby, než začnou mrazy a solkoovna bude vyte1pěna cele1. Pan spre1vce nabeddl, že ne1m přinese dalšed kamna (svoje vlastned), abychom tento proble9m vyřešili.