TI99 Environment

# TIWAIT, TIWAITKEY, TIWAITYN and CHECKALPHA

Syntax

TIWAIT(time)

TIWAITKEY()

string-variable = TIWAITYN()

CHECKALPHA()

Description

The TIWAIT(time) function will pause the program for the specified time. Time is expressed in milliseconds (one thousandth of a second). 1000 milliseconds = 1 second. TIWAITKEY() will pause the program until a key on the keyboard or the A or B button on the gamepad are pressed. string-variable = TIWAITYN() will pause the program until either the "Y" or "N" key on the keyboard or the A or B button on the gamepad are pressed. The A button is equivalent to "Y" and the B button is equivalent to "N". The string variable will return the value "Y" or "N" when the program resumes from the pause. CHECKALPHA is usually placed right at the beginning of the program to check for the Alpha Lock (Caps Lock) key state on the keyboard. If Caps are Off, the program will pause and display a message until the user sets Caps on. Once the Alpha Lock is on the message will be erased and the program will continue. This function is included for compatibility with original TI99 BASIC/XBASIC program files. During any of the above pauses, any auto-moving sprites will continue in motion.

Example Code

    _100: REM   *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
    _110: REM   *  SPRITE CHASE  *
    _120: REM   *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
    _130: REM  99'ER VERSION 7.81.1 - XB
    _140: REM  BY RON BINKOWSK1
    _150: REM
    _160: REM  CONVERTED TO TI99E
          CHECKALPHA()
    _170: CALL_CLEAR()
    _180: TI_PRINT(1,"USE THE FOUR ARROW KEYS AND W,R,Z,C KEYS TO CHASE THE   LETTERS OR NUMBERS.")  :  TI_PRINT(0,"")
    _190: TI_PRINT(1,"YOU MUST CATCH THEM IN ALPHA NUMERIC SEQUENCE.")  :  TI_PRINT(0,"")
    _200: TI_PRINT(1,"PRESS 'L' FOR LARGE TARGET. 'S' FOR SMALL TARGET.")  :  TI_PRINT(0,"")
          TI_SYNC()
    _210: GOT = CALL_KEY(0,GOT,STATUS) : STATUS = TIKEYSTATUS
    _220: IF STATUS = 0 THEN GOTO _210
    _230: IF GOT = 76
             T = 8     ` Tolerance (for Call_Coinc)
             CALL_MAGNIFY(2)
          ELSE
             IF GOT = 83
                T = 4   ` Tolerance (for Call_Coinc)
             ELSE
                CALL_MAGNIFY(1)
                GOTO _210
             ENDIF
          ENDIF
    _240: TI_PRINT(1,"FOR NUMBERS PRESS'N'"): TI_PRINT(1,"FOR LETTERS PRESS 'L'.")  :  TIWAITKEY()
    _250: GOT = CALL_KEY(0,GOT,STATUS) : STATUS = TIKEYSTATUS
    _260: IF STATUS = 0 THEN GOTO _250
    _270: IF GOT = 78
            TARGS = 10
            CH = 47
          ELSE
             IF GOT = 76
                 TARGS = 26
                 CH = 64
             ELSE
                 GOTO _250
             ENDIF
          ENDIF
    _280: CALL_CLEAR()
    _290: RANDOMIZE TIMER()
    _300: COUNT = timer()
          SSP = 20
    _310: CALL_COLOR(3,2,9)  :  CALL_COLOR(4,2,9)
    _320: CALL_CHAR(96,"FFFFFFFFFFFFFFFF")
    _330: CALL_SPRITE(28,96,2,90,120,0,0)
    _340: FOR A = 1 TO TARGS
          REPEAT : CLR = RND(13) + 3  : UNTIL CLR <> 8 AND CLR <> 16
    _350: CALL_SPRITE(A,A + CH,CLR,90,120,RND(49)-25,RND(49)-25)  : TIWAIT(350)
    _360: NEXT A
          DELAY = 1000 : TIWAIT(DELAY)
          DCOUNT = timer()
    _380: FOR A = 1 TO TARGS
    _390: CALL_COLORSPRITE(A,16) : TI_SYNC()
    _400: COUNT = (TIMER() - DCOUNT) * .006
          DISPLAY_AT(24,1,STR$(COUNT),6)
    GOT = CALL_KEY(0,GOT,STATUS) : STATUS = TIKEYSTATUS
    _430: HIT = CALL_COINC(28,A,T)
    _440: IF HIT = -1 THEN GOTO _620
    _450: IF STATUS = 0 THEN TI_SYNC() : GOTO _400
    _460: IF GOT = 69 THEN CALL_MOTION(28,-SSP,0)  :  GOTO _540
    _470: IF GOT = 88 THEN CALL_MOTION(28,SSP,0)  :  GOTO _540
    _480: IF GOT = 68 THEN CALL_MOTION(28,0,SSP)  :  GOTO _540
    _490: IF GOT = 83 THEN CALL_MOTION(28,0,-SSP)  :  GOTO _540
    _500: IF GOT = 87 THEN CALL_MOTION(28,-SSP,-SSP)  :  GOTO _540
    _510: IF GOT = 82 THEN CALL_MOTION(28,-SSP,SSP)  :  GOTO _540
    _520: IF GOT = 90 THEN CALL_MOTION(28,SSP,-SSP)  :  GOTO _540
    _530: IF GOT = 67 THEN CALL_MOTION(28,SSP,SSP)
    _540: COUNT = (TIMER() - DCOUNT) * .006
          DISPLAY_AT(24,1,STR$(COUNT),6) :
          GOT = CALL_KEY(0,GOT,STATUS) : STATUS = TIKEYSTATUS
    _550: HIT = CALL_COINC(28,A,9)
    _560: IF HIT = -1 THEN GOTO _620
    _590: IF STATUS = -1 THEN TI_SYNC() : GOTO _540
    _600: CALL_MOTION(28,0,0)
    _610: TI_SYNC() : GOTO _400
    _620: CALL_DELSPRITE(A)
    _640: CALL_MOTION(28,0,0)
          COUNT = (TIMER() - DCOUNT) * .006
          DISPLAY_AT(24,1,STR$(COUNT),6)
          TI_SYNC()
    _650: NEXT A
    _660: CALL_CHARSET() : CALL_DELSPRITEALL() : CALL_CLEAR()
    _670: TI_PRINT(1,"YOUR SCORE IS " + STR$(COUNT))
    _680: TI_PRINT(1,"'Y' TO PLAY AGAIN,'N' TO END")
          GOT$ = TIWAITYN()
    _710: IF GOT$ = "Y" THEN GOTO _170
    _720: TI_PRINT(8,"BYE") : TIWAIT(DELAY)
    END

Go back to ...

TI99E Commands Menu
Main Menu

Copyright © Carlos Santiago Lebron - TI99 Environment 2020