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

How do I get a turtle to wirelessly run a program?

Started by robo10000, 16 September 2012 - 02:28 AM
robo10000 #1
Posted 16 September 2012 - 04:28 AM
Hello y'all, I just got Tekkit yesterday and have only learned the existence of Computercraft today. Now I'm trying to learn the API code and I'm like a blind man stumbling in the dark.

I've looked at the turtle api information and every tutorial I can find, but everything seems so specific to situations and nothing has helped me yet.

What I want:

1- My Mining Turtle to wait for a signal
2- I type "Turtle" into my computer
3- My Mining Turtle runs the rest of my code

I have absolutely no idea how to even transmit from the wireless modem. I know I need rednet.open("side") on both of them, but other than that, nothing has helped me. Even the simple tutorial on this gives me "attempt to call nil" on line 3

Thanks for anyone who can help
Loopin #2
Posted 16 September 2012 - 05:38 AM
Do this in WIRELESS Mining Turtle:


local event,p1,p2,p3=os.pullEvent()
rednet.open("right ")

if event=="rednet_message" and p2=="@doit" then
--The code
And this in your computer with an attached modem:

rednet.open("modemside")
rednet.send(turtleid,"@doit")-- or turtle.broadcast("@doit") for the turtle id go into it and use command id.
etopsirhc #3
Posted 16 September 2012 - 05:51 AM
what i'd do is hva the turtle wait for a message
then phrase the message by spaces
and finaly call shell.run(arg[0],arg[1],ect )

have a table with 10 args , all set to "" and over write them when an actual arg comes in via rednet

also this way you can tell the turtlle to do anything that it has programs to do
Lyqyd #4
Posted 16 September 2012 - 06:41 AM
There are quite a few remote shell programs people have written. There's even at least one tutorial in that section of the forums.