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

Mirror screen

Started by Trey2.k, 19 December 2013 - 11:47 AM
Trey2.k #1
Posted 19 December 2013 - 12:47 PM
I was wondering if it was possible to be able to be doing one thing on a computer and have tides play on a monitor so other people can see what you are doing
Lyqyd #2
Posted 19 December 2013 - 01:21 PM
Look around the forums. This has been posted innumerable times. I think at least one was called "mirror API", there are several others.
Trey2.k #3
Posted 19 December 2013 - 02:02 PM
Look around the forums. This has been posted innumerable times. I think at least one was called "mirror API", there are several others.
ok thank you very much :)/>
TheOddByte #4
Posted 19 December 2013 - 04:35 PM
You can also override the term functions which is used for drawing and use them to draw on the monitor as well as on the terminal.
Functions that are most important for this
  • term.write( string )
  • term.clear()
  • term.setCursorPos( x, y )
  • term.setCursorBlink( boolean )

local mon = peripheral.wrap("<Monitor Side")

oldTermWrite = oldTermWrite or term.write
term.write = function( text )
	oldTermWrite( text )
	mon.write( text )
end

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

oldClear = oldClear or term.clear
term.clear = function()
	oldClear()
	mon.clear()
end

oldBlink = oldBlink or term.setCursorBlink
term.setCursorBlink = function( boolean )
	oldBlink( boolean )
	mon.setCursorBlink( boolean )
end
Edited on 19 December 2013 - 03:36 PM
Lyqyd #5
Posted 19 December 2013 - 06:03 PM
And term.clearLine, and term.scroll, and term.setTextColor, and term.setBackgroundColor, etc. Probably best to just use an existing API.
Alice #6
Posted 19 December 2013 - 06:14 PM
I would do this to mirror, but I'm not sure if it would work.

local screens = {"monitor_1", "monitor_0"}
for i=1, #screens do
local curScreen = peripheral.wrap(screens[i])
term.redirect(curScreen)
--[[Todo here]]
end
term.restore()
Can someone confirm this code?