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

Messages displayed onto a Monitor

Started by Thorfin25, 01 November 2013 - 06:48 PM
Thorfin25 #1
Posted 01 November 2013 - 07:48 PM
I'm fairly new to the whole CC thing but I know my way around a few things. One concept I cannot seem to grasp though is emmiting a rednet message onto an adjacent monitor from a computer. The code I tried (and horridly failed) was a simple one.

side = "right"
text = "Thorfin25"
red = "back"
rednet.close(red)
rednet.open(red)
mon = peripheral.wrap(side)
mon.setTextScale(2)
local x, y = rednet.recieve
while true do
mon.setCursorPos(1,1)
mon.write(text)
mon.setCursorPos(1,2)
mon.write(y)
mon.setCursorPos(1,3)
mon.write(textutils.formatTime(os.time(),false)) -- use true for 12h time
sleep(1)
mon.clear()
term.setCursorPos(1,1)
end
Lyqyd #2
Posted 01 November 2013 - 08:13 PM
Split into new topic.

You have to actually call the receive function:

local x, y = rednet.receive()
Thorfin25 #3
Posted 02 November 2013 - 09:44 AM
I forgot to write that in my code, but I have been calling it with the () when I start it up I get no errors, the screen just remains blank.
Lyqyd #4
Posted 02 November 2013 - 02:12 PM
Please make sure you typed the rest of it over correctly, verifying that each and every single character is exactly the same.
Thorfin25 #5
Posted 03 November 2013 - 11:35 AM

side = "right"
text = "Thorfin25"
red = "back"
rednet.close(red)
rednet.open(red)
mon = peripheral.wrap(side)
mon.setTextScale(2)
local x, y = rednet.receive()
while true do
  mon.setCursorPos(1,1)
  mon.write(text)
  mon.setCursorPos(1,2)
  mon.write(y)
  mon.setCursorPos(1,3)
  mon.write(textutils.formatTime(os.time(),false))
  time
  sleep(1)
  mon.clear()
  term.setCursorPos(1,1)
end
Lyqyd #6
Posted 03 November 2013 - 02:24 PM
Here's a few changes:


side = "right"
text = "Thorfin25"
red = "back"
rednet.close(red)
rednet.open(red)
mon = peripheral.wrap(side)
mon.setTextScale(2)
local x, y = rednet.receive()
--# got rid of the loop since it would never write anything different.
mon.setCursorPos(1,1)
mon.write(text)
mon.setCursorPos(1,2)
mon.write(y)
mon.setCursorPos(1,3)
mon.write(textutils.formatTime(os.time(),false))
--# got rid of "time" line, since that would throw an '=' expected error.
--# got rid of sleep and clear lines, since it will only ever write one message.
Sgt.Mike #7
Posted 05 November 2013 - 11:36 AM
I see you just wanted to print a Message in a Monitor.I Seriously simplified your Code Down there


rednet.open("back")
mon.setTextScale(2)
mon.setCursorPos( 1,1 )
print [[
ALL THE TEXT YOU WANT
THEN END WITH DOUBLE SQUARE BRACKETS ]]
rednet.close("back")

Some optional stuff that might help you.
If you use term.setBackgroundColor( colors.— ) and dont use term.clear() then the screen will not have its full background color changed.
Only the background color behind the letters will.This might have helped you a little