323 posts
Location
Boston, MA
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…
286 posts
Location
Bonn Germany
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
2005 posts
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.