This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
sleawnis's profile picture

Turtle Idea help

Started by sleawnis, 29 October 2012 - 03:56 PM
sleawnis #1
Posted 29 October 2012 - 04:56 PM
i was thinking of making a turtle program to like the outsides of my buildcraft quarry, to make them look less ugly, i was thinking of starting at the bottom and going up. i was going to use a code that was something like

x = 1

turtle.back()
turtle.place()
x + 1

if x = 15 then

turtle.turnLeft()

then repete sumhow but i need it too change inventory slots aswell. can sumbody make me a quick code for it pelase? :P/>/> it might also need to detect walls insted actualy cause when i go out of chunk it would stop and then start allover again from startup?
remiX #2
Posted 29 October 2012 - 05:56 PM
You need to know the basics for this, it's shouldn't be a major code.

Basic loops

This will make the turtle move forward 20 times.

for i = 1, 20 do
  turtle.forward()
end

To select different slots
turtle.select(5)
this will select slot 5 of the turtle.

To make it detect for a block, you use
turtle.detect()
-- this will return a Boolean (i.e. true or false)

if turtle.detect() then    -- If it detects a block it will print 'there is a block infront of me!'
  print("There is a block infront of me!")
else
  print("There is no block infront of me :P/>/>")
end

Just google Turtle API and look for basic codes and go on from there :P/>/>