Jump to content




Term.scroll?


  • You cannot reply to this topic
4 replies to this topic

#1 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

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?

#2 KDJSAIUH

  • Members
  • 35 posts

Posted 28 October 2013 - 09:00 AM

maybe its used i like this
type help credits

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

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.

#4 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

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.

#5 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 28 October 2013 - 09:27 AM

View PostHellkid98, on 28 October 2013 - 09:21 AM, said:

Would have been great if there was an example as yours in the wiki
Done.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users