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

Screen logger

Started by KaoS, 22 October 2012 - 10:50 AM
KaoS #1
Posted 22 October 2012 - 12:50 PM
Hey pro people, I am busy making a screen logger and resumer for a project of mine. everything is working fine except it will not take the term.scroll function into account.

I apologise that it is such a long code, the scroll modifier starts at line 104 but you may need to read the top part to understand how the record works, here is the pastebin: http://pastebin.com/JMUMUgUL

Thanks for the help
KaoS #2
Posted 22 October 2012 - 09:20 PM
no ideas guys? I added comments to the code to make it a little easier to understand, in order to fully understand it you need to understand metatables, before I understood them I tried Google and found an amazing article. in case you need it here is a link
ChunLing #3
Posted 22 October 2012 - 09:47 PM
Sorry, I'm fixing my code to get rid of ipairs (and do other stuff). This function still successfully calls the oterm.scroll, right? It just doesn't log correctly all the information you're trying to save. Which…are you trying to save the entire screen?
KaoS #4
Posted 23 October 2012 - 12:25 AM
exactly. as you write to your screen it writes to my log. it works perfectly except it doesn't scroll
PixelToast #5
Posted 23 October 2012 - 12:41 AM
mine just attaches perimeter hooks to all the term functions :3
ChunLing #6
Posted 23 October 2012 - 01:00 AM
Why are you trying to save the whole screen? The log already contains all the output information, you just need to log that the screen scrolled, not reiterate everything that was on the screen when it scrolled.
KaoS #7
Posted 23 October 2012 - 04:09 PM
I am moving everything up one in the log. it doesn't need everything ever entered, just what is currently on the screen
ChunLing #8
Posted 23 October 2012 - 05:27 PM
Looks more complicated than necessary. I have to let my brain recover a while before tackling it.
Lyqyd #9
Posted 23 October 2012 - 05:42 PM
You are doing this the hard way, you know. Why not just use a redirect target that updates a buffer table before calling the main term functions?
KaoS #10
Posted 23 October 2012 - 06:13 PM
I'm not sure how that works… anyways thanks for the help. I'll take a look
Lyqyd #11
Posted 23 October 2012 - 07:49 PM
An example of this would be found near the top of this file: https://github.com/lyqyd/LyqydOS/blob/master/window

That may be a useful reference or source of inspiration.
KaoS #12
Posted 24 October 2012 - 05:24 AM
Thanks, I am looking through it. the thing is I cannot find one instance of you actually calling the function new(). trying to figure out the syntax for target. guess I'll just look up the full code

but great code hey

EDIT: found it, I was thinking of doing it this way. I tried it in the past and made a mess of it. oh well, back to the drawing board ^_^/>/> time for an overhaul. thanks for the help Lyqyd, you too ChunLing. much appreciated
KaoS #13
Posted 24 October 2012 - 06:39 AM
lol still not working. I have a question. term.native.write ignores redirects right?