Jump to content




Running programs on both monitor and computer

help lua

  • You cannot reply to this topic
2 replies to this topic

#1 MarioBG

  • Members
  • 43 posts
  • LocationSpain (or Hisperia)

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!

#2 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

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 by Hellkid98, 09 December 2013 - 12:43 PM.


#3 Wojbie

  • Members
  • 631 posts
  • LocationKinda lost

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users