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

[QUESTION] Wireless Program Transmission

Started by Lear85, 23 March 2012 - 10:27 PM
Lear85 #1
Posted 23 March 2012 - 11:27 PM
I've created a program for my turtle. It chops down the trunk of RedPower's massive rubber trees. But there is one major problem…

disc drives magically turn to modems when placed, so I can't store my program on a floppy. Breaking the turtle would destroy my program, and it would take far too much time to manually drive the turtle to the top of the tree. One of my best options would be to download the program from the Turtle to the Computer. How can I do this?
Advert #2
Posted 24 March 2012 - 01:27 AM
I'm guessing you're playing on a server with the bukkit port installed; you'll have to wait until the bug is fixed.
Hawk777 #3
Posted 24 March 2012 - 07:18 AM
It shouldn't be too hard to write a pair of programs to do this. The receiver program opens a file and a modem and then reads data from the modem and writes it into the file; the sender opens a file and a modem and then reads data from the file and sends it over the modem. I don't have the code off-hand, but it should be straightforward.
kamnxt #4
Posted 24 March 2012 - 03:13 PM
Rednet sender code:
Spoiler
 --sender
side = "left" -- modem side
filename = "file" -- File name
rednet.open(side)
print("Sending...")
f = fs.open(filename,"r")
rednet.broadcast(f.readAll())
f.close()
print("File sent.")
Rednet receiver code:
Spoiler


--receiver
side = "right" -- modem side
filename = "file" -- File name
timeout = 20 -- timeout in seconds, set to nil for no timeout
rednet.open(side)
print("Receiving...")
a,b = rednet.receive(timeout)
if b then
f = fs.open(filename,"w")
f.write(:(/>/>
f.close()
print("Received.")
else
print("Timed out.")
end
Sebra #5
Posted 24 March 2012 - 05:28 PM
Breaking the turtle would destroy my program, …
Give a label to you turtle and it will not forget programms. :(/>/>
and it would take far too much time to manually drive the turtle to the top of the tree
from the top only?

Can I see your code? Just look.
Luanub #6
Posted 25 March 2012 - 02:21 AM
I believe this has been fixed on Bukkit. Install the latest and greatest MCPC and CC from them mcportcentral and you should be good. If not I would recommend posting on their boards.