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

Multiple Turtles Excavating at once over rednet.

Started by HeadRebel, 21 October 2012 - 09:30 PM
HeadRebel #1
Posted 21 October 2012 - 11:30 PM
I was attempting to activatem multiple turtles all at once over the Rednet, and for the most part I seem to have it close, the only issue I was having, and wondering if it was even possible, was causing each turtle on the network to use the Excavate program at once.

Is this even possible, or do I need a custom lua program to do this?
Doyle3694 #2
Posted 21 October 2012 - 11:36 PM
well if you broadcast the message then it wouldn't be too hard. If you don't know what I'm talking about,tell me and I'll give you an example
Doyle3694 #3
Posted 21 October 2012 - 11:43 PM
I've got some time so I'll give you some code:

For main computer:

rednet.open("enter which side the modem is on here")
rednet.broadcast("START")
rednet.close("enter which side the modem is on here")

For the turtles:

rednet.open("right")
while true do
   senderID, message = rednet.receive()
   if message == "START" then
	  rednet.close("right")
	  shell.run("excavate", "10")
   end
end
HeadRebel #4
Posted 22 October 2012 - 12:46 AM
I'm a complete newbie to LUA, so how would I go about entering all of this into a turtle? Do I need to use a Floppy, or is it possible to send them the excavate command without needing to program them all?
ChunLing #5
Posted 22 October 2012 - 01:05 AM
They gotta be programmed. If you're in SSP, then you can just pause the game, open the save folder and put the file into the subfolder for that turtle's ID (type "id" into the console to find out the id of a computer or turtle). Otherwise, yeah, floppy.

You can make a floppy that has a simple file receiving program, and then transmit text files (including lua programs) to them. Or you can use pastebin (if enabled), though for a program this short that's kinda overkill.