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

print on monitor and computer?

Started by koslas, 10 October 2012 - 08:38 AM
koslas #1
Posted 10 October 2012 - 10:38 AM
I am wondering, how would I make a program that displays the same thing on a computer, also on a monitor next to it
ex: I play worm on the computer, I can see it in the computer, and others can see it on a monitor next to the computer
faubiguy #2
Posted 10 October 2012 - 10:41 AM
I think this Sync Api is what your looking for.
koslas #3
Posted 10 October 2012 - 10:49 AM
sortof, but I just want a program where I type 'dualScreen' (the program name) and then it will show whatever is on the computer on the monitor, and I can still see whatever I do on the computer, so I run that program, then another program and it will show me the same thing on the monitor, aswell as the computer
faubiguy #4
Posted 10 October 2012 - 11:14 AM
Using that API I linked to, you can do this:

os.loadAPI("sync")
local args = {...}
if #args < 1 then
 print("No Program Given")
 return
end
sync.addMonitors()
sync.redirect(true)
shell.run(...)
sync.restore()

This will work like you said, with dualScreen program_to_run argument1 argument2 etc. The main problem is if the monitor and computer screen aren't exactly the same size, it will use the monitor size for displaying things, which can cause things to go of the edge of the computer screen.