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

[Lua] Receiveing command through rednet and running program

Started by Xenophon, 14 January 2013 - 09:07 AM
Xenophon #1
Posted 14 January 2013 - 10:07 AM
Hi

I am trying to send command via rednet from computer (ex. go up 1) to wireless turtle, and then have turtle run program named same as command.d
Turtle should run program "go up 1" when computer sends it message "go up 1" and run program "go down 2" when computer sends it message "go down 2".

Computer code:

rednet.open("left")
rednet.send(6,read())

Turtle code:

rednet.open("right")
id, message = rednet.receive()
Luanub #2
Posted 14 January 2013 - 10:16 AM

shell.run(message)
Engineer #3
Posted 14 January 2013 - 10:20 AM

rednet.send(id, message)


P1, p2, p3 = rednet.receive()
Shell l.run("p2")
Xenophon #4
Posted 14 January 2013 - 10:29 AM
Turtle says no such program after it received command "go up 1" from computer.
Used code on turtle:


rednet.open("right")
id,message=rednet.receive()
shell.run(message)
remiX #5
Posted 14 January 2013 - 10:39 AM
Turtle says no such program after it received command "go up 1" from computer.
Used code on turtle:


rednet.open("right")
id,message=rednet.receive()
shell.run(message)

Are you sending exactly and only 'go up 1'
It should work, if it says no such program, then there's no go program on the turtle
Xenophon #6
Posted 14 January 2013 - 10:46 AM
First I run program on turtle for receiving command, then one on computer for sending, after running it it asks me for input in which I type "go up 1" without quotation, then I leave it and right click turtle where it says No such program.

EDIT

Using command on turtle directly works.
ChunLing #7
Posted 14 January 2013 - 12:56 PM
put a print to print out what you're using in shell.run()
RunasSudo-AWOLindefinitely #8
Posted 14 January 2013 - 01:01 PM
Try these (in separate programs)

Firstly, try
shell.run("go up 1")

If that works, then try
rednet.open(  SIDE  )
id, message = rednet.receive()
print(message)
shell.run(message)

If that works, then your program is doing something weird.