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

Synchronized Terminal Redirection POC

Started by Espen, 28 March 2012 - 01:19 PM
Espen #1
Posted 28 March 2012 - 03:19 PM
Description
Makes it possible to have I/O over multiple monitors at once.





New functions
syncScreens( bSync )
  • true - Synchronizes I/O over all screens.
  • false or nil - Only last active screen has I/O interaction. (native behaviour)
redirectDims( bRedirect )
  • true - Screen dimensions of the last monitor in the chain take precedence. (native behaviour)
  • false or nil - Dimensions of the CC terminal take precedence.


Clarification
I haven't put this together into a standalone addon yet, hence these are direct changes to the stock Term API.
It's a Proof-of-Concept, if you will, which I only made out of curiosity by playing around with the redirection code of the Term API.
That means in order to make use of this, you need to replace the original file (and reboot the CC computers).
But before you replace anything: Make a backup of the original file!



Installation
  1. Download the modified term.
  2. (If you downloaded the .zip, unpack the term file from it first)
  3. Go into: .minecraft/mods/ComputerCraft/lua/rom/apis/
  4. Make a backup of the original term file within that folder!
  5. Place the previously downloaded term into that folder.
  6. Reboot currently running in-game computers for changes to take effect on them.



Download:

Usage
  • Redirect terminal I/O to another monitor by issuing (as usual):
  • term.redirect( monitor )
    …where 'monitor' is the wrapped monitor-peripheral of your choice. Do this as many times in a row as you like.
  • Now, to synchronize the I/O over all screens (i.e. all monitors you've redirected to, as well as the original terminal), issue the following command:
  • term.syncScreens( true )
    To turn I/O Synchronization off again (and return I/O to the last monitor in the redirect stack):
    term.syncScreens( false )
  • To have the last monitor's dimensions take precedence over all other screens, issue this:
  • term.redirectDims( true )
    To return precedence back to the original terminal's dimensions:
    term.redirectDims( false )


Notes
I haven't yet tested if / how the different monitor text sizes affect the behaviour.
Oh, and just in case someone's still wondering what POC stands for: It's an acronym for Proof-of-Concept.

K, I hope my explanations were sufficient enough. If there are any questions or ambiguities left, ask away.
Other than that, have fun. :o/>/>
Advert #2
Posted 28 March 2012 - 03:34 PM
Nicely done, both the post and the POC.
toxicwolf #3
Posted 02 April 2012 - 10:39 AM
This is really good! I would be interested to see if you could make this POC run as a standalone API, rather than a replacement.
Espen #4
Posted 02 April 2012 - 02:57 PM
This is really good! I would be interested to see if you could make this POC run as a standalone API, rather than a replacement.
I'd love to, but I'm quite busy with uni at the moment and have to code in two different languages.
Maybe if I have some time the next few weekends and feel like it I might do it if nobody else has.
But until then I'm afraid you're gonna have to use the replacement.
The way I changed it makes it default to the original behaviour of term.
So until you call one of the new functions it won't differ from the normal term command.
toxicwolf #5
Posted 02 April 2012 - 07:05 PM
This is really good! I would be interested to see if you could make this POC run as a standalone API, rather than a replacement.
I'd love to, but I'm quite busy with uni at the moment and have to code in two different languages.
Maybe if I have some time the next few weekends and feel like it I might do it if nobody else has.
But until then I'm afraid you're gonna have to use the replacement.
The way I changed it makes it default to the original behaviour of term.
So until you call one of the new functions it won't differ from the normal term command.
Thats fine, I didn't mean for you to do it right now anyway :)/>/>
I don't need it, but it is really cool!
FuzzyPurp #6
Posted 08 April 2012 - 08:39 PM
Nicely done, both the post and the POC.

What he said ^
toxicwolf #7
Posted 21 May 2012 - 04:19 PM
Hi, just thought I'd let you know that I added support for this POC in my WolfOS. Hope this is okay by you, keep up the good work!