Difference between revisions of "Turtle Stairbuilder (tutorial)"

From ComputerCraft Wiki
Jump to: navigation, search
(Programming your Stairbuilder)
(Undo revision 4601 by 184.71.12.166 (talk))
 
(8 intermediate revisions by 6 users not shown)
Line 3: Line 3:
 
Welcome to this [[:Category:Tutorials|tutorial]] about Turtle Stairbuilders.
 
Welcome to this [[:Category:Tutorials|tutorial]] about Turtle Stairbuilders.
  
Those are GREAT shots Ash  I love everyone and you mearird the perfect person for you! I think you are a dynamic dueo! THanks for sharing these, so cute!!! I love that baby  Tonight when we were out to eat, Lindsay pointed out this little girl who literally looked just like me when I was a little girl it was uncanny! These shots made me think of that, because of the  beautiful blue eyes of that baby!
+
==Programming your Stairbuilder==
 +
In this code we will program a stairbuilder that simply goes up a flat surface, when the wall ends it will create a stairway coming off of the wall
 +
 
 +
First we want it to determine the top of the wall
 +
<code>
 +
  while turtle.detect() do
 +
  turtle.up()
 +
end
 +
</code>
 +
next we want it to decend one block and create the staircase
 +
<code>
 +
while turtle.detect() do
 +
  turtle.up()
 +
end
 +
turtle.down()
 +
turtle.back()
 +
turtle.place()
 +
while not turtle.detectDown() do
 +
  turtle.back()
 +
  turtle.down()
 +
  turtle.place()
 +
end
 +
print("Staircase Built")
 +
</code>
 +
And there's your code!
  
 
==Uses==
 
==Uses==
  
With a little modification this can be used in ravines to go up or down. Very useful in the nether if your stuck or are fighting off a ghast. Can be used in multiplayer RPG games and such.
+
With a little modification this can be used in ravines to go up or down. It can be very useful in the nether if you're stuck or are fighting off a ghast. This program can also be used creatively in multiplayer RPG games to traverse difficult obstacles.
  
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]

Latest revision as of 13:13, 4 December 2012

Introduction

Welcome to this tutorial about Turtle Stairbuilders.

Programming your Stairbuilder

In this code we will program a stairbuilder that simply goes up a flat surface, when the wall ends it will create a stairway coming off of the wall

First we want it to determine the top of the wall

while turtle.detect() do
 turtle.up()
end

next we want it to decend one block and create the staircase

while turtle.detect() do
 turtle.up()
end
turtle.down()
turtle.back()
turtle.place()
while not turtle.detectDown() do
 turtle.back()
 turtle.down()
 turtle.place()
end
print("Staircase Built")

And there's your code!

Uses

With a little modification this can be used in ravines to go up or down. It can be very useful in the nether if you're stuck or are fighting off a ghast. This program can also be used creatively in multiplayer RPG games to traverse difficult obstacles.