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

Computer screen on monitor (HELP!)

Started by oscar124, 17 November 2014 - 04:48 PM
oscar124 #1
Posted 17 November 2014 - 05:48 PM
How do i show everything on the computer screen on a monitor while i use it? :mellow:/> :mellow:/>

I have been looking everywhere for an answer yet still not found one. :o/>

Please help, :(/>

// Oscar124
KingofGamesYami #2
Posted 17 November 2014 - 06:14 PM
There is not default way to do this. As far as I know, nobody has made an api that does this on CC 1.6 yet. Other than that, just make a function that writes to the monitor and the terminal at the same time, and use that in your program.
oscar124 #3
Posted 17 November 2014 - 06:16 PM
There is not default way to do this. As far as I know, nobody has made an api that does this on CC 1.6 yet. Other than that, just make a function that writes to the monitor and the terminal at the same time, and use that in your program.

Hmm…
KingofGamesYami #4
Posted 17 November 2014 - 06:18 PM

function writeBoth( text )
  mon.write( text )
  term.write( text )
end

function setBothCursor( x, y )
  term.setCursorPos( x, y )
  mon.setCursorPos( x, y )
end
--#etc.
oscar124 #5
Posted 17 November 2014 - 07:43 PM
Yeah..i know..
Dog #6
Posted 17 November 2014 - 08:08 PM
I have a feeling you're already aware of this, but … fwiw, if you're only dealing with text, I'd combine both functions into a single function like this…

local function drawBoth(x, y, text)
  term.setCursorPos(x, y)
  term.write(text)
  mon.setCursorPos(x, y)
  mon.write(text)
end

drawBoth(2, 2, "Test")

I realize it's not exactly what you're looking for, but it would allow you code everything once per text/line and display it on both screens. This is definitely less efficient than KingofGamesYami's implementation if you're writing a line of text in multiple colors; but if you're only using a single color, this would reduce your code a bit more than KingofGamesYami's suggestion.
Edited on 17 November 2014 - 07:13 PM