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

Monitor Program Help

Started by Alice, 09 May 2013 - 01:54 PM
Alice #1
Posted 09 May 2013 - 03:54 PM
Since it is the Programs area, I need help with the program 'Monitor'. I am using the new Network Cables, and want to link up my computer. Both modems are linked, but if I type monitor top lua it won't run…
Meeshu #2
Posted 09 May 2013 - 04:00 PM
I haven't used Network Cables, but try doing yourMonitorVar = peripheral.wrap("top") if you haven't already. If that doesn't work let me know and I'll be happy to experiment until I get it.
TorakTu #3
Posted 09 May 2013 - 04:25 PM
look at this code I slapped together for you.. The new line function I snagged from somewhere on this forum. I forget where.

This will display to the monitor on top of the computer. And it will wait for the other computer to send it a message.
COMPUTER 1
Spoiler
mySide = "left"

local m = peripheral.wrap("top")

function NewLine()
   local _,cY = m.getCursorPos()
   m.setCursorPos(1,cY+1)
end

m.clear()
m.setCursorPos(1,1)

rednet.open(mySide)
m.write("Standing By...")
NewLine()
m.write(os.getComputerID())
local event, message, senderChannel, replyChannel, message, senderDistance = os.pullEvent()
m.clear()
m.setCursorPos(1,1)
m.write("The message was sent to : " ..message)
NewLine()
m.write("Channel : " ..senderChannel)
rednet.close(mySide)
NewLine()
m.write("Done")
NewLine()

This will let you broadcast the message over the network. The other computer which is listening will hear it and display the message on the screen.
COMPUTER 2
Spoiler

mySide = "left"
function nl()
	local _,cY = term.getCursorPos()
	term.setCursorPos(1,cY+1)
end
term.clear()
term.setCursorPos(1,1)
term.write(os.getComputerID())
nl()
rednet.open(mySide)
rednet.broadcast("Some Awesome Message !!!")
rednet.close(mySide)
term.write("Done")

Remember.. both computers that have a networking cable between them can not go beyond 63 blocks.. that means 63 or less blocks of networking cable between them. The computers count toward that number as well.

Also the MODEMS have to show RED . or that red-ish box inside the modem.. it reminds me of a red light I guess. It has to show on for the modem to be active. When you right click the modem you will notice the red "light" turning on or off.

Enjoy.

EDIT UPDATE : Updating my answer so as to explain the 64 block limit. I had forgot to mention that the reason for the 64 block limit is not that the mod or network cable itself is limited, its the fact that your character in the game loads a range of up to 64 blocks out from your character's position into memory. So once you move out of that area ( or the range of the other computer and / or the networking cable ), that chunk is no longer in memory. HOWEVER, if you use a chunkloader.. like chickenchunk for example, you can then send a signal across the network even further out then the 64 limit. I have tried it up to 256 blocks away, and it works, as long as the computer it talks too, as well as the lines in between, are staying in memory.
Lyqyd #4
Posted 09 May 2013 - 05:05 PM
Moved to Ask a Pro.
Zudo #5
Posted 22 May 2013 - 02:00 AM
I have never bothered to learn the new networking stuff, I just use wireless modems and the rednet API so I could not help you here :(/>
Lyqyd #6
Posted 22 May 2013 - 10:21 AM
I have never bothered to learn the new networking stuff, I just use wireless modems and the rednet API so I could not help you here :(/>/>

Wait, you posted in order to let everyone know that you had nothing useful to post? Seriously?