Posted 30 March 2013 - 07:39 PM
Client code:
http://www.pastebin.com/YL0DARc6
Turtle code:
http://pastebin.com/5429xBk
The problem;
When I try and call the recall function it does nothing. No error. Nothing.I know the rednet signal is going, because I can use any of the other functions and it works correctly.
(Since there's no comments, I'll try and explain here. The recall function tries to make the turtle "retrace" its steps. I know the turning, moving and whatnot isn't perfected yet- but that's not the problem. Yet.)
http://www.pastebin.com/YL0DARc6
Spoiler
rednet.open("top",true)
args = {...}
rednet.send(1, args[1])
rednet.send(1, args[2])
Turtle code:
http://pastebin.com/5429xBk
Spoiler
Sorry for no comments!
[CODE]
while true do
rednet.open("right", true)
amount = 0
h = fs.open("recall", "w")
senderId, command = rednet.receive()
senderId, direction = rednet.receive()
if command == "go" and direction == "forward" then
turtle.forward()
h.writeLine("forward")
amount = amount+1
end
if command == "recall" then
recall()
end
if command == "turn" and direction == "left" then
turtle.turnLeft()
h.writeLine("left")
amount = amount+1
elseif command == "turn" and direction == "right" then
turtle.turnRight()
h.writeLine("right")
amount = amount+1
elseif command == "turn" and direction == "backwards" then
turtle.turnRight()
turtle.turnRight()
amount = amount+1
h.writeLine("backward")
end
function recall()
rcl = fs.open("recall", "r")
if rcl.readLine(amount) == "forward" or rcl.readLine() == "backwards" then
turtle.turnRight()
turtle.turnRight()
amount = amount-1
elseif rcl.readLine(amount) == "left" then
turtle.turnRight()
amount = amount-1
elseif rcl.readLine(amount) == "right" then
turtle.turnLeft()
amount= amount-1
end
end
end
The problem;
When I try and call the recall function it does nothing. No error. Nothing.I know the rednet signal is going, because I can use any of the other functions and it works correctly.
(Since there's no comments, I'll try and explain here. The recall function tries to make the turtle "retrace" its steps. I know the turning, moving and whatnot isn't perfected yet- but that's not the problem. Yet.)