This subprocedure can be used when you have a complex program and need to show the user a lot of instructions.
The subprocedure may be called to scroll very long instructions at the bottom of the screen. I placed some text in a string variable named msg$. You can adjust the code to suit your preferences. The instructions may be placed in a text file. The file can be opened and read into the string variable or group of variables if it's longer than 256 characters.
You could put a different message at the bottom of the screen, or place the line telling the user to press a certain key to start the scrolling instructions.
I finished it up by waiting 2 seconds and replacing the bottom line with the beginning of the message. You could simply blank it out after a short wait, or put back the notice for the user to press a certain key to scroll the instructions again.
Notice that I used double parentheses around the ((msg$)) argument to call the sub. This passes the msg$ variable By Value instead of By Reference. It keeps the original value of the message and prevents it from becoming corrupted or growing longer with each new repeat.
DECLARE SUB Scroll (msg AS STRING)
DIM msg AS STRING
msg$ = "This is a very long message that will scroll around. It will serve as instruction for using a software program and should stay on the bottom line. "
CLS
LOCATE 25, 1
PRINT LEFT$(msg$, 80);
DO
LOCATE 1, 1
PRINT "Press any key to display the scrolling instruction line; Esc to end"
E$ = INPUT$(1)
IF E$ <> CHR$(27) THEN CALL Scroll((msg$))
LOOP UNTIL E$ = CHR$(27)
END
SUB Scroll (msg AS STRING)
DIM startmsg AS STRING
DIM N AS INTEGER
N = LEN(msg)
DIM ch AS STRING
DIM circuit AS INTEGER
circuit = 0
startmsg$ = msg$
VIEW PRINT 25 TO 25
DO
circuit = circuit + 1
ch = MID$(msg$, 1, 1)
msg$ = MID$(msg$, 2, N - 1) + ch
PRINT LEFT$(msg$, 80);
pause = .1
t = TIMER
DO WHILE t + pause >= TIMER: LOOP
LOOP UNTIL circuit = N - 80
DO WHILE t + 2 >= TIMER: LOOP
PRINT LEFT$(startmsg$, 80);
VIEW PRINT
END SUB
I used E$ as the second argument in the sub, so you only have to press the Esc key once to stop.
==========================================================================
DECLARE SUB Scroll (msg AS STRING, E AS STRING)
DIM msg AS STRING, E AS STRING
msg$ = "This is a very long message that will scroll around. It will serve as instruction for using a software program and should stay on the bottom line. "
CLS
LOCATE 25, 1
PRINT LEFT$(msg$, 80);
DO
LOCATE 1, 1
PRINT "Press any key to display the scrolling instruction line; Esc to end"
E$ = INPUT$(1)
IF E$ <> CHR$(27) THEN CALL Scroll((msg$), E$)
LOOP UNTIL E$ = CHR$(27)
SYSTEM
SUB Scroll (msg AS STRING, E AS STRING)
DIM startmsg AS STRING
DIM N AS INTEGER
N = LEN(msg)
DIM ch AS STRING
DIM circuit AS INTEGER
circuit = 0
startmsg$ = msg$
VIEW PRINT 25 TO 25
DO
circuit = circuit + 1
ch = MID$(msg$, 1, 1)
msg$ = MID$(msg$, 2, N - 1) + ch
PRINT LEFT$(msg$, 80);
pause = .1
t = TIMER
DO WHILE t + pause >= TIMER: LOOP
E$ = INKEY$
LOOP UNTIL circuit = N - 80 OR E$ = CHR$(27)
DO WHILE t + 2 >= TIMER: LOOP
PRINT LEFT$(startmsg$, 80);
VIEW PRINT
END SUB
This message has been edited by Solitaire1 on Mar 8, 2009 4:01 PM
Re: Scroll long instructions on bottom line of screen
April 2 2009, 8:36 AM
SCREEN 12
DIM ms%(2295)
msg$ = "This is a very long message that will scroll around. It will serve as instruction for using a software program and should stay on the bottom line. "
lenght% = LEN(msg$)
FOR position% = 1 TO lenght%
LOCATE 30, 1
PRINT MID$(msg$, position%, 80);
FOR offset% = 1 TO 8
GET (2, 465)-(639, 478), ms%
PUT (1, 465), ms%, PSET
NEXT
msg$ = "This is a very long message that will scroll around. It will serve as instruction for using a software program and should stay on the bottom line. "
lenght% = LEN(msg$)
LOCATE 1, 1
PRINT "Press any key to display the scrolling instruction line; Esc to end"
E$ = INPUT$(1)