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

How to send a command to a turtle

Started by HurdeHack, 20 March 2012 - 03:21 PM
HurdeHack #1
Posted 20 March 2012 - 04:21 PM
hi ive watched to the topic how to work with a modem or else but i still dont know how to send a command to a turtle wireless
can anybody help?
Liraal #2
Posted 20 March 2012 - 04:39 PM
you actually need quite a bit of code:

while true do
local _,command=rednet.receive(1)
local exec=loadstring(command)
command()
end

and this is about the most basic setup you will find. there is also quite a lot of software for this on the forum, just look for it.
HurdeHack #3
Posted 20 March 2012 - 04:40 PM
if looked XD! btw TNX
HurdeHack #4
Posted 20 March 2012 - 04:55 PM
it says now ::attempt to call string::?
Liraal #5
Posted 20 March 2012 - 05:02 PM
ah, sorry, simple mistype, it should be:
exec()
not command()
HurdeHack #6
Posted 20 March 2012 - 05:04 PM
it does say now ::attempt to call nil::
Liraal #7
Posted 20 March 2012 - 05:07 PM
have you sent a proper command?, e.g.
rednet.send(11,"turtle.dig()")
if so, try

while true do
local _,command=rednet.receive()
local exec=loadstring(command)
command()
sleep(1)
end