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

[Question] Mining Turtle Block placer

Started by Stormkrow, 04 July 2012 - 02:05 PM
Stormkrow #1
Posted 04 July 2012 - 04:05 PM
Hi all,

Im trying to find out if its possible to set a turtle into a 'block placing mode' per say and then giving it a material to place on a certain level and when it bumps gets to an obstacle goes in another direction? If so what would be the means to do it?
If anyone can hint me in the right direction i'd most appreciate it:D
Thanks
Stormkrow #2
Posted 04 July 2012 - 04:31 PM
Ok well i got most of the code done, but heres my question, how do i make it so that if the turtle detects a block in front of it it will turn right?
MysticT #3
Posted 04 July 2012 - 04:47 PM

if turtle.detect() then
  turtle.turnRight()
end
Stormkrow #4
Posted 04 July 2012 - 04:59 PM
Hmm i got that right now thanks, what im trying to do is make a turtle place blocks in a square and the when it detects it has made a full square it moves a lane inwards to complete a full square platform. My problem is making it go within the inner lane once its completed a set
D3matt #5
Posted 04 July 2012 - 05:21 PM
Uh… What?
Stormkrow #6
Posted 04 July 2012 - 05:48 PM
LOL ok lemme rather ask this, is there a way to make a turtle count how many blocks it goes?
MysticT #7
Posted 04 July 2012 - 05:58 PM
You can count it using a variable:

local count = 0

local function forward()
  if turtle.forward() then
    count = count + 1
  end
end