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

Running programs on both monitor and computer

Started by MarioBG, 09 December 2013 - 07:39 AM
MarioBG #1
Posted 09 December 2013 - 08:39 AM
Hello, I've recently been working on my OS and I want to make an inauguration on my private server. However, I need something to allow me to display what's on the screen also on the monitor. I'm on 1.4.7, anyone knows how to do this or any program to help me? Please, it's very important. Thanks!
TheOddByte #2
Posted 09 December 2013 - 12:43 PM
Well let's say that you have wrapped the monitor like this

local mon = peripheral.wrap( "<side here!>" )

Then you'll have to override some term functions so that what is written in the terminal is written on the monitor

oldTerm_write = term.write -- Backing up the old term function
term.write = function( text ) -- Declaring it as a new function
	oldTerm_write( text)  -- Calling the old function
	mon.write( text ) -- Calling the function for the monitor
end

oldTerm_cursorPos = term.setCursorPos
term.setCursorPos = function( x, y )
	oldTerm_cursorPos( x, y )
	mon.setCursorPos( x, y)
end

oldTerm_clear = term.clear
term.clear = function()
	oldTerm_clear()
	mon.clear()
end

But make sure you only run this file once and don't run it again while the computer is booted, Else it will error.
So it would be best todo this in the startup file, Now if you want to have colors you'll have to try to override them yourself and see if you understood the code above.
Edited on 09 December 2013 - 11:43 AM
Wojbie #3
Posted 09 December 2013 - 08:09 PM
If you want working program example take a look at mine mirror utility program.

Its made to duplicate and ensure same size of computer terminal and monitor contents. You should be able to modify it to your needs easily.