home *** CD-ROM | disk | FTP | other *** search
- ;----------------------------------------------------------------------------
- ; Copyright(C) 1996, The AEGiS Corporation
- ;----------------------------------------------------------------------------
- ;
- ; PROCEDURE PrintScramble()
- ;
- ; This procedure writes a string with a random scramble effect
- ;
- ; Warning : This procedure NEEDS to find spaces where the string will be
- ; printed... if not, a endless loop will occur...
- ; To ensure taht everything is ok, you should add a CLS before or someting
- ; like :
- ; Print Space(len(Str))
- ; Backup len(Str)
- ;----------------------------------------------------------------------------
- #lib
- Declare Procedure PrintScramble(String Str)
- Declare Procedure PS_RemCursor()
- Declare Procedure PS_Synchronize()
- Boolean PS_NoRemCursor
- Boolean PS_NoSynchro
-
- ;----------------------------------------------------------------------------
- Procedure PrintScramble(String Str)
-
- Integer v_int1, v_int2, v_int3, v_int4, v_int5, v_int6, v_int7
- String v_str1
-
-
- v_int4 = getx() ; backup position
- v_int5 = gety() ;
- v_int7 = curcolor() ; backup color
-
- v_int2 = len(Str) ; length of string -> v_int2
-
- While (1) Do
- v_int1 = random(v_int2-1)+1 ; we randomly generate a number depending on
- ; v_int2 (witch begins with the string len)
- v_int3 = 0
- v_int6 = 0
- While (1) do ; do until v_int6 is not v_int1 (random number)
- inc v_int3
- v_str1 = ScrText(v_int4+v_int3-1,v_int5, 1, False)
- if (v_str1 = " ") inc v_int6 ; if char pointed is a space, inc v_int6
- if (v_int6 = v_int1) Break
- Endwhile
- AnsiPos v_int4+v_int3-1,v_int5 ; ok so we have now the nth space (n = random)
- v_str1 = Mid(Str, v_int3, 1)
- if (v_str1 != " ") Then ; if the char to print is a space, print
- Print v_str1 ; a char 255, if not, print it...
- else
- Print chr(255)
- endif
- dec v_int2 ; dec v_int2 so we cannot go over the
- if (v_int2 = 0) Break ; amount of spaces available
- PS_RemCursor() ; remove cursor
- Delay 1 ; add some delay
- PS_Synchronize() ; wait for other end
- Color v_int7 ; restore color
- Endwhile
-
- EndProc
-
- Procedure PS_RemCursor()
-
- If (!PS_NoRemCursor) Then
- AnsiPos 1,23
- Color 0
- Print " "
- Backup 1
- Endif
-
- EndProc
-
- Procedure PS_Synchronize()
-
- If (!PS_NoSynchro) Then
- While (Outbytes() > 0) Do
- EndWhile
- Endif
-
- EndProc
-