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

More built-in term functions

Started by LDDestroier, 22 December 2015 - 11:53 AM
LDDestroier #1
Posted 22 December 2015 - 12:53 PM
Basically, what I suggest is extra functions for the term/monitor API.
This is what I imagine would be quite useful:

Spoiler

term.getSelectedChar(x,y)
Returns the character on the screen at those coordinates (x,y), as well as it's text and background color.\
Use:

term.getSelectedChar(1,1) --> "C", 16, 32768


term.getScreen()
Returns the entire contents of the screen in a string format, as well as all their text and background colors ready to be blit'd.
Use:

term.blit(term.getScreen()) --(reprints the contents of the screen)
--(if mon is a monitor object)
term.blit(mon.getScreen()) --(prints the contents of the monitor)
Edited on 22 December 2015 - 11:58 AM
Creator #2
Posted 22 December 2015 - 01:16 PM
They would be extremely useful for activating a buffer AFTER a script, program, shell, anything has been started.
Bomb Bloke #3
Posted 22 December 2015 - 01:20 PM
I'm not really one for writing suggestions when I can just write the code myself, but it's struck me on more than a couple of occasions that having this sort of functionality built into the window API would be handy.

Kinda worth noting that term.blit() doesn't handle anything term.write() doesn't handle; eg, line breaks.