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

How to Make a Computer print to a monitor

Started by ebernerd, 08 February 2013 - 01:27 PM
ebernerd #1
Posted 08 February 2013 - 02:27 PM
So… yeah…


I want to make an amusement park program that when I make it, it will broadcast that will print the open rides on a monitor. So, how do I code it? I have toyed around with it for about 10 minutes…
xuma202 #2
Posted 08 February 2013 - 02:54 PM
Just wrap the monitor

monitor = peripheral.wrap("top")
assuming the monitor is placed above the computer. You can use left,right back,front and bottom instead too.

now call monitor.write("Hello")
to find out about the other methods read this:
http://computercraft.info/wiki/Monitor#Peripheral_Functions
ChunLing #3
Posted 08 February 2013 - 08:03 PM
You can also use term.redirect() so as to make all the screen output automatically go to the monitor. The use of the monitor peripheral functions is good when you only want to update certain parts of the monitor, and still have the console display more detailed program output, while term.redirect() is easier in most cases to quickly adapt a program to display on a monitor.

You can also use the monitor program to run a program on a monitor. The relevant part of the code that does this is:
local monitor = peripheral.wrap( sSide )
term.redirect( monitor )
shell.run( sProgram, select( 3, ... ) )
term.restore()
The rest of the monitor program just makes sure that you have a monitor and a program.