Jump to content




Turtle Idea help


  • You cannot reply to this topic
1 reply to this topic

#1 sleawnis

  • Members
  • 29 posts

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?

#2 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

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/>





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users