home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / homonlib.zip / SLIDE.BAS < prev    next >
BASIC Source File  |  1995-04-13  |  2KB  |  52 lines

  1. DEFINT A-Z
  2.  
  3. DECLARE SUB Slide (text$, lr, row, col, delay)
  4.  
  5. SUB Slide (text$, lr, row, col, delay)
  6. '****************************************************************************
  7. 'Slides text onto the screen to the left or right starting at the specified
  8. ' row and column.
  9. '
  10. 'The direction is determined by the argument lr, where a zero value equals
  11. ' left, non-zero equals right.
  12. '
  13. 'delay is measured in 100ths of a second.
  14. '
  15. '****************************************************************************
  16.  
  17. d! = delay                              'Convert delay from an integer to a
  18.                                         'single precision variable.
  19.  
  20. IF d! < 1 THEN d! = 5                   'Assign the default delay of 1/20th
  21.                                         'of a second (5/100).
  22.  
  23. d! = d! / 100                           'Change delay to 100ths of a second.
  24.  
  25. FOR x = 1 TO LEN(text$)
  26.  
  27.      IF lr = 0 THEN                     'Slide to the left
  28.          
  29.           IF (col - x + 1) < 1 THEN          'If the column position becomes
  30.                EXIT FOR                      'illegal (0 or less), stop.
  31.           END IF
  32.  
  33.           LOCATE row, col - x + 1            'Print one character at a time,
  34.           PRINT LEFT$(text$, x);             'from left to right.
  35.     
  36.      ELSE                               'Slide to the right
  37.     
  38.           LOCATE row, col                    'Print one character at a time,
  39.           PRINT RIGHT$(text$, x);            'from right to left.
  40.  
  41.      END IF
  42.  
  43.      now! = TIMER                       'Get current value of TIMER.
  44.      WHILE TIMER < (now! + d!): WEND    'Wait for timer to increase by d!
  45.  
  46.      IF INKEY$ <> "" THEN d! = 0        'If a key is pressed, stop delaying.
  47.  
  48. NEXT x
  49.  
  50. END SUB
  51.  
  52.