| Original Message |
Solitaire (Login Solitaire1) S Posted Jan 23, 2010 12:33 PM
I added a STATIC Boolean variable to allow any key to start or stop the message from scrolling. It will scroll continuously, restarting from the beginning when done.
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 start or stop 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
STATIC onoff 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$
IF E$ <> CHR$(27) AND E$ <> "" THEN
onoff = NOT onoff
IF onoff = -1 THEN SLEEP
END IF
IF circuit = N - 80 THEN circuit = 0
LOOP UNTIL E$ = CHR$(27)
VIEW PRINT
CLS
END SUB
|
|
|