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

Can I get help with some rednet messengers?

Started by Twinflare, 13 June 2014 - 05:28 PM
Twinflare #1
Posted 13 June 2014 - 07:28 PM
I need help getting my program to work properly. It pops up an error when I run it, it was working fine but it stopped.
I have three computers, 42,43, and 44. 42 is connected to a monitor, and 43 is my deep mine computer. 44 is a relayer and works perfect.

My "messenger" program looks a little like this.

Spoiler

print("Hello welcome to Zero Messenger 1.0.1!")
term.setCursorPos(1,2)
print("---------------------------------------------")
term.setCursorPos(1,3)
print("Which monitor ID would you like to send a message to?")
receiver = read()
if receiver == 43 then
  id = 44
end
if receiver == 44 then
   print("Incorrect Destination")
   shell.run("messenger")
end
term.setCursorPos(1,6)
print("What is your message?")
message = read()
rednet.send(id, message)

What am I doing wrong? Or what can I do to make this work better.
Cranium #2
Posted 13 June 2014 - 07:33 PM
You need to convert your reciever variable to a number, as read() only returns strings.

reciever = tonumber(read())