scrolls text in an array, all variables like visible etc tied together neatly.
globals was in case i slipped into functions etc..
traps to one key press per up down arrow keys.
created for someone who never replied back
useful here maybe.
REM START THE ENVIRONMENT WITH THE 3D BACKGROUND ON
sync on : sync rate 60 : backdrop on : randomize timer()
REM THE MAXIMUM AMOUNT OF LINES THE TEXT SCROLLER WILL HOLD
GLOBAL MaxLines : MaxLines = 25
REM THE VISIBLE AMOUNT OF ROWS IT WILL DISPLAY
GLOBAL VisibleLines : VisibleLines = 10
REM THE FONTSIZE STORED INTO A VARIABLE FOR DISPLAY PURPOSES
GLOBAL FontSize : FontSize = 14
REM THE TEXT BUFFER COUNT THE PLAYER ADJUSTS
GLOBAL TBC : TBC = 0
REM SETUP THE FONT AND SIZE
set text font "Verdana" : set text size FontSize
REM MAKE A TXT_DATA TYPE/ARRAY TO HOLD THE TEXTUAL DATA
TYPE TXT_DATA
LINENUM AS INTEGER
TEXTLINE AS STRING
ENDTYPE
dim TXT_DATA(MaxLines) as TXT_DATA
REM FILL THE TEXTUAL DATA WITH SOME STUFF
for i = 1 to MaxLines
TXT_DATA(i).LINENUM = i
TXT_DATA(i).TEXTLINE = "Textual Data Information "+STR$(RND(10000))
next i
REM MAIN LOOP
disable escapekey : while escapekey()=0
REM DISPLAY THE ACTUAL OUTPUT
for i = 1 to VisibleLines
text 5,i*FontSize,"[: " + STR$(TXT_DATA(i).LINENUM+TBC)+ " : " + TXT_DATA(i+TBC).TEXTLINE
next i
REM PLAYERS CONTROL UP DOWN KEYS
rem ------------------------------------------------------------------------------------------
rem UPKEY TRAP PRESS ONCE
rem ------------------------------------------------------------------------------------------
If keystate(200)=1 and Upkey_switch=0
Upkey_toggle=1-Upkey_toggle
Upkey_switch=1
Endif
If keystate(200)=0 then Upkey_switch=0
if Upkey_toggle = 1
TBC = TBC + 1
if TBC > MaxLines - VisibleLines
TBC = MaxLines - VisibleLines
endif
Upkey_toggle = 0
endif
rem ------------------------------------------------------------------------------------------
rem DOWNKEY TRAP PRESS ONCE
rem ------------------------------------------------------------------------------------------
If keystate(208)=1 and Downkey_switch=0
Downkey_toggle=1-Downkey_toggle
Downkey_switch=1
Endif
If keystate(208)=0 then Downkey_switch=0
if Downkey_toggle = 1
TBC = TBC - 1
if TBC < 1
TBC = 0
endif
Downkey_toggle = 0
endif
REM END MAIN LOOP
sync : endwhile