Posted 17 March 2017 - 03:26 AM
Here is the script of my turtle:
The problem is towards the end of the script. After send("Now that we're settled…"), the turtle just stops sending rednet signals to the computer that is hooked up to the monitor and just exits the script without listening to the last few bits of code. There is no error in any of the 4 computers. As you can see, I got frustrated and even let the system refresh and reboot before it moved on, but it still didn't work.
Any solutions?
function clear(x)
term.clear()
term.setCursorPos(1,x)
end
function send(message)
rednet.broadcast(message)
end
function label(num)
term.setBackgroundColor(colors.white)
term.setTextColor(colors.red)
clear(1)
print("Professor T")
term.setTextColor(colors.black)
term.setCursorPos(1,3)
end
function menu()
label()
end
--Startup
local m = fs.open("refresh","r")
local n = m.readLine()
m.close()
if n == "false" then
rednet.open("left")
label()
send("clear")
send("Hello class! Professor T will be with you in a moment.")
local senderID, message, protocol = rednet.receive()
local t = fs.open("opening","w")
t.write(message)
t.close()
local senderID, message, protocol = rednet.receive()
local t = fs.open("lesson-1","w")
t.write(message)
t.close()
local senderID, message, protocol = rednet.receive()
local t = fs.open("lesson-2","w")
t.write(message)
t.close()
local senderID, message, protocol = rednet.receive()
local t = fs.open("lesson-3","w")
t.write(message)
t.close()
local senderID, message, protocol = rednet.receive()
local t = fs.open("lesson-4","w")
t.write(message)
t.close()
shell.run("desk")
send("clear")
send("Now that we're settled, I am Professor T.")
local j = fs.open("refresh","w")
j.writeLine("true")
j.close()
shell.run("reboot")
else
sleep(2)
label()
rednet.open("left")
send("I am your teacher for today.")
sleep(3)
end
The problem is towards the end of the script. After send("Now that we're settled…"), the turtle just stops sending rednet signals to the computer that is hooked up to the monitor and just exits the script without listening to the last few bits of code. There is no error in any of the 4 computers. As you can see, I got frustrated and even let the system refresh and reboot before it moved on, but it still didn't work.
Any solutions?