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

Turtle Program Not Doing Anything Until I Open The Gui

Started by crazyadam0, 23 November 2013 - 04:55 PM
crazyadam0 #1
Posted 23 November 2013 - 05:55 PM
I am making a turtle quarry program which sounds simple but when you have many many turtles and try to organize them to do it efficiently it is not as easy. My code grabs a turtle, fuel and moves up, places a new turtle to do the same, and then moves (eventually to its position) out of the way. It works just fine, but I have to right click on each new turtle after it is placed. Any ideas on what causes this and how to fix this. It works fine after I right click them but they don't move until I do so. Here is my code (This is in a floppy drive under the turtles and ran as startup):


rednet.open("right");
local ID = os.getComputerID();
local x = 0;
local y = 0;
local z = 0;
local xs;
local zs;

function placeNewTurtle()
  if turtle.detect() then
	turtle.turnRight();
  end
  turtle.turnLeft();
  turtle.suck();
  turtle.turnRight();
  turtle.up();
  turtle.placeDown();
end
if turtle.detect() then
  turtle.turnRight();
end
turtle.turnRight();
turtle.suck();
turtle.refuel();
turtle.turnLeft();
placeNewTurtle();
turtle.forward();
turtle.forward();
arctivlargl #2
Posted 23 November 2013 - 06:01 PM
Computers and turtles need to be told to turn on. This happens when a player right clicks on them.

Alternatively you can have a computer turn another one on with a peripheral call (like in the GPS deployment turtle code)

peripheral.call("bottom","turnOn") is probably what you want right after turtle.placeDown()
Bomb Bloke #3
Posted 23 November 2013 - 06:10 PM
peripheral.call("bottom","turnOn")
crazyadam0 #4
Posted 23 November 2013 - 06:18 PM
Thank you! i figured out what was wrong. The turtle below wasn't even ON until i opened the GUI. Thanks i never knew that was a command. Thank you so much!