15 posts
Location
The Overworld
Posted 02 May 2012 - 06:12 PM
Im trying to make a program that sends a message over rednet to a turtle. When the message is recieved by the turtle it runs a program. How do i do this?
351 posts
Posted 02 May 2012 - 07:04 PM
The turtle has to be running a program that is listening for messages. You can test if it is the right message with a if statement, and then use shell.run() to run your program.
146 posts
Location
the Netherlands
Posted 02 May 2012 - 10:07 PM
Something like this:
rednet.open('right')
event, sender, msg = os.pullEvent('rednet_message')
if sender == 5 then --change to the id of the host computer
if msg == 'Go forward' then -- change to the message
shell.run('Anotherprogram', arguments)
end
end
15 posts
Location
The Overworld
Posted 04 November 2012 - 02:07 AM
Thanks for the replies!
It took me ages to reply because I forgot I had even posted this. Your code works great and thanks both of you for your help :D/>/>
Clicking green doohickey!