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

Having a turtle run a program on another turtle.

Started by BrolofTheViking, 26 September 2012 - 04:05 PM
BrolofTheViking #1
Posted 26 September 2012 - 06:05 PM
I have been trying to get a wireless turtle to tell a crafty turtle to run a program. I've used various methods, but none seems to work. I'm not a very experienced coder in general, and only actually started using lua for computercraft 4 days ago. Any help would be greatly appreciated.

If there isn't a way to do this directly, I was thinking of having the first turtle move floppy disks around, and put them into a disk drive next to the crafty turtle, then have it run though that.
MetalMiner #2
Posted 26 September 2012 - 06:13 PM
Wireless turtle:

local craftyID = *ID here*

print("Enter the program to run:")
local program = read()
rednet.send(craftyID, program)

Crafty turtle (must have a wireless modem, too):

local id, program = rednet.receive()
shell.run(program)

hope i helped :P/>/>
BrolofTheViking #3
Posted 26 September 2012 - 07:19 PM
Wireless turtle:

local craftyID = *ID here*

print("Enter the program to run:")
local program = read()
rednet.send(craftyID, program)

Crafty turtle (must have a wireless modem, too):

local id, program = rednet.receive()
shell.run(program)

hope i helped :P/>/>
Thank you for trying, but the problem lies in that it doesn't seem to be possible to create a wireless crafting turtle. The program doesn't need to be sent from on turtle to the other, the crafting turtle can have the program saved itself, but I need some way to instruct it to run the program without using rednet.

Edit: Well, the server I'm doing this on isn't ported to 1.3.2 yet, but I suppose I could create the program as if there is a wireless crafting turtle, since it should be ported soon.
MetalMiner #4
Posted 26 September 2012 - 08:18 PM
You can do it with a redstone input…:
Wireless turtle:

rs.setOutput("front", true)
sleep(0.5)
rs.setOutput("front", false)
Crafty turtle:

while true do
  if turtle.getInput("back") then
    shell.run("program")
  end
end
But this works max. for six programs (each input side one).
BrolofTheViking #5
Posted 28 September 2012 - 05:45 PM
Yes I had thought of that as well… This would require far more than 6 crafting recipes, though I could theoretically do a multiple layer thing so that it does it as a sort of passcode, like top-left-right tells it to make planks or something like that, but it would be an enormous hassle, and I was hoping for something simpler
KaoS #6
Posted 28 September 2012 - 09:50 PM
BrolofTheViking's idea is just fine…. have you tried it?
OmegaVest #7
Posted 28 September 2012 - 10:01 PM
Also, if you program the delivery turtle (requester/first/non-crafty) with a bunch of recipes, and have it grab resources, or require recources before it will go, then you can have it do "drop 1, redstone, drop 1, etc." until it reaches 9, while the crafty moves every time its inventory slots reach item count 1. Then crafty crafts, non-crafty pulls.

I'll make a chart if this is too confusing.