4 posts
Posted 28 May 2012 - 07:49 AM
i cant seem to get my computer to tell my turtle to do the lumberjack command
yes i have got modems on both
startup code:
rednet.open ("right")
os.pullEvent()
if event=="rednet.message" and p1==1
if p2 == "runlumberjack" then
shell.run("lumberjack")
end
sending message:
rednet.open ("top")
rednet.send (0,"runlumberjack")
1111 posts
Location
Portland OR
Posted 28 May 2012 - 08:16 AM
you need to capture the output of the event in vars when you do os.pullEvent()
startup
rednet.open ("right")
local event, p1, p2 = os.pullEvent()
if event=="rednet.message" and p1==1
if p2 == "runlumberjack" then
shell.run("lumberjack")
end
4 posts
Posted 28 May 2012 - 04:44 PM
doesn't seem to want to work
get this message when i use it
startup program used:
rednet.open ("right")
local event, p1, p2 = os.pullEvent()
if event=="rednet.message" and p1==1
if p2 == "runlumberjack" then
shell.run("lumberjack")
end
error message received:
bios : 206 : [string "startup"] : 4 : 'then' expected
i really want it to work for my turtle
1604 posts
Posted 28 May 2012 - 05:23 PM
You are missing the "then" on the first if and an "end" to close it. Also, the event is "rednet_message", not "rednet.message".
rednet.open("right")
local event, p1, p2 = os.pullEvent()
if event=="rednet_message" and p1==1 then
if p2 == "runlumberjack" then
shell.run("lumberjack")
end
end
4 posts
Posted 29 May 2012 - 12:39 AM
ty for that