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

Term.scroll?

Started by TheOddByte, 28 October 2013 - 07:55 AM
TheOddByte #1
Posted 28 October 2013 - 08:55 AM
Hello everyone, I looked at the wiki on term.scroll and well.. It doesn't say much about it.
I'm wondering, What does it do? How do you use it?
kaioo1312 #2
Posted 28 October 2013 - 09:00 AM
maybe its used i like this
type help credits
theoriginalbit #3
Posted 28 October 2013 - 09:07 AM
It does exactly what it says it does, it scrolls the content by the number of lines supplied.

Do note however that if content goes off the top when scrolled back down it will not be there anymore, any content that goes off the screen is lost.

Example

term.clear()
term.setCursorPos(1, 10)
print("Hello world")
--# the text is on the 10th line
term.scroll(1)
--# the text is on the 9th line
term.scroll(-2)
--# the text is on the 11th line
Positive numbers scroll the screen upwards, negative numbers downwards. To help remember, think of it as the number of lines to be added to the bottom, if 2 lines are added to the bottom it pushes all the content upward, if 2 lines are taken from the bottom the content "falls" down and two rows appear at the top.

Basically its the way that the shell (and write) easily deal with scrolling the content when you get to the bottom of the screen.
TheOddByte #4
Posted 28 October 2013 - 09:21 AM
Thanks TOBIT, So that's kinda what they are using when you use the list program?
Anyways.. Now I know that, Would have been great if there was an example as yours in the wiki since that always helps me to understand how to use it.
theoriginalbit #5
Posted 28 October 2013 - 09:27 AM
Would have been great if there was an example as yours in the wiki
Done.