Posted 19 June 2012 - 06:54 PM
Im pretty new to ComputerCraft and Lua, although I do have some experience using other languages, so I'm hoping someone could help me figure out why this program isn't working the way it should. I made a simple program for my turtle, where it listens for a rednet message, and preforms a certain action, depending on what it receives. If it receives a message that isn't one of the things it reacts to, it broadcasts "error", and the program ends. When I run the program, it broadcasts "error", no matter what message it receives.
print("Minion Mode Engaged")
rednet.open("right")
while true do
id, message = rednet.receive()
print("Message receive")
if message == "go" then
turtle.forward()
elseif message == "up" then
turtle.up()
elseif message == "down" then
turtle.down()
elseif message == "left" then
turtle.turnleft()
elseif message == "right" then
turtle.turnright()
elseif message == "detect" then
rednet.broadcast(turtle.compare)
elseif message == "done" then
break
else rednet.broadcast("Error "..message )
break
end
end
I'm sure I'm just making some simple mistake, but I don't know what it is.