I have played around with this a bit, I can post some code tonight when I get home from work.
What I did was have all the text added to one string, then move the y position of the string to scroll it up and down. The string is confined to limited area of the screen.
The tricky part for me is determining how big to make the scroll bar. A really long string would have a small scroll bar, and vice versa.
In the meantime, here is some code to show how to limit text to an area on the screen. Use the mouse scroll wheel to move the text up and down.
// Project: Scrolling Text
// Created: 2019-03-27
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Scrolling Text" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
SetClearColor(100,100,100)
// set up some variables
BorderSpr = CreateSprite(0)
SetSpriteColor(BorderSpr,0,0,0,255)
SetSpriteSize(BorderSpr,304,604)
SetSpritePosition(BorderSpr,700,100)
BackgroundSpr = CreateSprite(0)
SetSpriteSize(BackgroundSpr, 300,600)
SetSpritePosition(BackgroundSpr,702,102)
Output$ = ""
for x = 1 to 20
Output$ = Output$ + "The quick brown fox jumps over the lazy dog. " + chr(10) +chr(10) + "It happens every time. "
next x
OutputTxt = CreateText(Output$)
SetTextSize(OutputTxt,30)
SetTextColor(OutputTxt,0,0,0,255)
TextPosition = 102
SetTextPosition(OutputTxt,704,TextPosition)
// make the text wrap to the next line
SetTextMaxWidth(OutputTxt,300)
// limit the text to the background sprite
SetTextScissor(OutputTxt,704,102,1004,702)
do
MouseWheel = GetRawMouseWheelDelta()
if MouseWheel < 0
TextPosition = TextPosition + (MouseWheel * 8)
SetTextPosition(OutputTxt,704,TextPosition)
endif
if MouseWheel > 0
TextPosition = TextPosition + (MouseWheel * 8)
SetTextPosition(OutputTxt,704,TextPosition)
endif
Sync()
print(MouseWheel)
loop