home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a067 / 1.img / GRUMP501.EXE / TTY.PRG < prev    next >
Encoding:
Text File  |  1991-04-29  |  1.5 KB  |  57 lines

  1. /*
  2.     Program: TTY()
  3.     System: GRUMPFISH LIBRARY
  4.     Author: Greg Lief
  5.     Copyright (c) 1988-90 Grumpfish, Inc. - All Rights Reserved
  6.     Clipper 5.x Version
  7.     Compile instructions: clipper tty /n/w/a
  8.  
  9.     Displays message on screen "teletype" style until keypress
  10. */
  11.  
  12. //───── begin preprocessor directives
  13.  
  14. #include "grump.ch"
  15.  
  16. //───── end preprocessor directives
  17.  
  18. function tty(nrow, msg, ndelay, nstopcol)
  19. local xcol := 0, yy, maxcol := maxcol(), ;
  20.       oldscrn := savescreen(nrow, 0, nrow, maxcol())
  21. if nrow <= maxrow()
  22.    GFSaveEnv()
  23.    //───── set sound and stop column if parameters were not passed
  24.    ndelay := if(ndelay == NIL, 0, ndelay)
  25.    nstopcol := if(nstopcol == NIL, -1, nstopcol)
  26.    do while inkey() = 0 .and. nstopcol != xcol
  27.       @ nrow, xcol ssay chr(32) + ;
  28.               if(xcol < maxcol, substr(msg, 1, maxcol-xcol), '')
  29.       if maxcol - xcol < len(msg)
  30.          @ nrow, 0 ssay substr(msg, maxcol + 1 - xcol, len(msg) - maxcol + xcol)
  31.       endif
  32.       if ndelay == 0
  33.          tone(MUSIC_TTY, 1)
  34.       else
  35.          for yy = 1 to ndelay
  36.          next
  37.       endif
  38.       if xcol == maxcol
  39.          xcol := 0
  40.       else
  41.          xcol++
  42.       endif
  43.    enddo
  44.    //───── reset previous environment
  45.    GFRestEnv()
  46.    //───── do not restore screen if stop column was passed
  47.    if nstopcol == NIL
  48.       restscreen(nrow, 0, nrow, maxcol, oldscrn)
  49.    endif
  50. endif
  51. return NIL
  52.  
  53. * end function TTY()
  54. *--------------------------------------------------------------------*
  55.  
  56. * eof tty.prg
  57.