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

A question about networks

Started by Jerreke, 09 May 2013 - 03:06 PM
Jerreke #1
Posted 09 May 2013 - 05:06 PM
Oke so i'm completely new to computercraft and programming in general so i'm sorry if this is already discussed somewhere.
I've been playing around with turtles for spawner purposses and after building a ender spawner i'm now finding myself having to program 38 turtles with the same program. Is there any way I can use the network to send the program to them (it's a pretty basic one but took me long enough to figure it out) and is there a place where I can piece togehter the code that will need to be written in that case?
Lyqyd #2
Posted 09 May 2013 - 05:09 PM
Split into new topic.
The_Awe35 #3
Posted 09 May 2013 - 06:35 PM
You can just use a disk drive and floppy disk (crafting recipes are on the wiki). set the disk drive next to the turtle with the code, and put the floppy in. then type "cp <file name> disk/<file name> " then, go to a new turtle. and set up the disk drive again. enter into the turtle "cd disk". then from there, enter "cp <filename> /disk" It should now be on the turtle. Repeat until all turtles have the code.
Jerreke #4
Posted 09 May 2013 - 06:56 PM
oke thank you i'll get that running then :)/>
H4X0RZ #5
Posted 09 May 2013 - 07:29 PM
Go to all turtles and type:

label set <something>
Into the shell, where <something> is a group.
P.S.: All turtles have to be in the same group!

Now (if you does that with all turtles), the program is on all turtles :)/>/>
Spongy141 #6
Posted 10 May 2013 - 02:45 AM
Sending a files over rednet? Simple…
Sender

fileName = {...}
rednet.open("right") --Change this is you want, make sure there is '' round the side...
file = fs.open(fileName[1],r')
rednet.broadcast(fileName[1])
fileData = file.readAll()
rednet.broadcast(fileData)
Receiver

rednet.open('right') --Again change the side if needed
id, fileName = rednet.receive()
file = fs.open(fileName,'a')
id, fileData = rednet.receive()
file.writeLine(fileData)
That should work… make sure to change the side to the proper modem side, if your using a turtle this should work with no problems, just do

<what you called the program> <file that you want to send>
PM me if you have any more problems with this…
Also to make this work better you can add some protocols so when it receives it will send a confirmation code that needs to be sent back or the program will not finish, its vital if you want to make sure nothing will go wrong.
GravityScore #7
Posted 10 May 2013 - 04:14 AM
Sending a files over rednet? Simple…
Sender

fileName = {...}
rednet.open("right") --Change this is you want, make sure there is '' round the side...
file = fs.open(fileName[1],r')
rednet.broadcast(fileName[1])
fileData = file.readAll()
rednet.broadcast(fileData)
Receiver

rednet.open('right') --Again change the side if needed
id, fileName = rednet.receive()
file = fs.open(fileName,'a')
id, fileData = rednet.receive()
file.writeLine(fileData)
That should work… make sure to change the side to the proper modem side, if your using a turtle this should work with no problems, just do

<what you called the program> <file that you want to send>
PM me if you have any more problems with this…
Also to make this work better you can add some protocols so when it receives it will send a confirmation code that needs to be sent back or the program will not finish, its vital if you want to make sure nothing will go wrong.

This would still require OP to go to all his turtles and install the receiving program on them, which was what he was trying to avoid. The label method would be the easiest.
Spongy141 #8
Posted 10 May 2013 - 11:13 AM
Sending a files over rednet? Simple…
Sender

fileName = {...}
rednet.open("right") --Change this is you want, make sure there is '' round the side...
file = fs.open(fileName[1],r')
rednet.broadcast(fileName[1])
fileData = file.readAll()
rednet.broadcast(fileData)
Receiver

rednet.open('right') --Again change the side if needed
id, fileName = rednet.receive()
file = fs.open(fileName,'a')
id, fileData = rednet.receive()
file.writeLine(fileData)
That should work… make sure to change the side to the proper modem side, if your using a turtle this should work with no problems, just do

<what you called the program> <file that you want to send>
PM me if you have any more problems with this…
Also to make this work better you can add some protocols so when it receives it will send a confirmation code that needs to be sent back or the program will not finish, its vital if you want to make sure nothing will go wrong.

This would still require OP to go to all his turtles and install the receiving program on them, which was what he was trying to avoid. The label method would be the easiest.
No, he could also put the program into

--For windows
/mods/ComputerCraft/lua/rom/programs/turtle
I just thought of that…. but still, that would be even easier.