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

Rednet Stops Sending Signal Well Into Code

Started by moneymaster2012, 17 March 2017 - 02:26 AM
moneymaster2012 #1
Posted 17 March 2017 - 03:26 AM
Here is the script of my turtle:

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?
valithor #2
Posted 18 March 2017 - 07:02 AM
Could you post the code that the computer that is receiving this messages is running? I am wondering if it is actually something else other than this code that is causing you to believe that the code is not running. I do not see any reason that those lines would not be run.