Re: WSMaker 2.0

 BBS: Inland Empire Archive
Date: 11-04-92 (18:04)             Number: 316
From: VICTOR YIU                   Refer#: NONE
  To: ZACK JONES                    Recvd: NO  
Subj: Re: WSMaker 2.0                Conf: (2) Quik_Bas
 -=> Quoting Zack Jones to Victor Yiu <=-

 screen saver routine...

Well, it is nothing major at all -- I even wonder why you ask...

My program is structured (WSMaker) so that whenever the program waits for
a keystroke with INKEY$ (that's all it uses -- it occurs in a total of
about... 10 places), a CALL Clock (X) is also executed within the loop:

DO
    I$ = INKEY$
    Clock 0
LOOP UNTIL LEN(I$)
Clock 1

SUB Clock (Pressed%)

Clock checks if the time has advanced, and if so, it will write it in the
screen, and check if the time elapsed from the Last keystroke is more than
180 seconds.  If so, invoke ScreenSaver (SUB) and reset the counter when
done.

Clock is called with a parameter Pressed -- meaning if a key was just pressed
or not.

Here is SUB Clock:

DEFINT A-Z
SUB Clock (Pressed%) STATIC

    TimeCount& = Timr
    IF Pressed = 1 THEN LastKeyPress& = TimeCount&

    IF OldTime$ <> TIME$ THEN
        OldTime$ = TIME$

        ' REMOVE IF NEEDED!!!!
        'DEF SEG = 0
        'POKE 1047, PEEK(1047) AND (NOT 32)
        'DEF SEG

' why the hell am I doing this nasty routine to extract time, while I could
'use VAL()?  VAL is slow and requires floating point.

        Hour = (ASC(TIME$) - 48) * 10 + (ASC(MID$(TIME$, 2)) - 48)
        IF Hour > 12 THEN
            T$ = MID$(STR$(Hour - 12), 2) + MID$(TIME$, 3) + "pm"
            IF Hour = 0 THEN T$ = "12" + MID$(T$, 2)
            IF Hour < 10 THEN T$ = Blank$ + T$
        ELSE
            IF LEFT$(TIME$, 1) = "0" THEN
                T$ = Blank$ + MID$(TIME$, 2)
            ELSE
                T$ = TIME$
            END IF
            IF Hour = 0 THEN T$ = "12" + MID$(T$, 3)
            IF Hour < 12 THEN T$ = T$ + "am" ELSE T$ = T$ + "pm"
        END IF

        LOCATE 1, 68, 0
        COLOR 0, 7
        PRINT " ";
        IF ColorM THEN COLOR 15, 7
        PRINT T$;

        IF SSaver THEN
            Tim& = TimeCount&
            IF ((Tim& - LastKeyPress&) > SSDelay) THEN
                ScreenSaver
                LastKeyPress& = Timr
                'LastShow& = Timr
            END IF
        END IF
    END IF
END SUB

Hope it helps.  If you have any questions, just ask.  :-)

If you were asking about how to make the ACTUAL screensaver routine...
oooops!

... That a BlueWave packet in your pocket or are you just glad to see me?
--- Blue Wave/RA v2.10 [NR]
 * Origin: Hard Disc Cafe / Houston Texas / (713) 589-2690 / (1:106/30.0)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET