home *** CD-ROM | disk | FTP | other *** search
- @echo off
-
- REM This batch file creates a test pattern on screen using RAND.btm
- REM pseudo-random function. First we get random coordinates in range
- REM ([0,%_rows] [0,%_columns]), then lighten the character in the
- REM position a bit. The result will be a nice (random-like) pattern
- REM (hopefully not) characterising the RAND function itself.
-
- setlocal
- unalias *
- set ORow=%_row
- set OCol=%_column
-
- @if "%debug" ne "%0" @echo off
- set chars=176 177 178 219
- set fg_str=bri Bla
- set bg_str=Bla
-
- REM Actual pattern width and hight will be p_size*2
- REM Comment the line below to use the hole screen
- set p_size=5
-
- iff "%p_size" ne "" then
- set coords=%@int[%@eval[%_rows/2-%p_size-1]]
- set coords=%[coords] %@int[%@eval[%_columns/2-%p_size-1]]
- set coords=%[coords] %@int[%@eval[%_rows/2+%p_size]]
- set coords=%[coords] %@int[%@eval[%_columns/2+%p_size]]
- drawbox %[coords] 1 Bri Whi on Bla FILL Bla
- else
- cls Bri Bla on Bla
- endiff
-
- :testloop
- inkey /w0 %%a
- if "%a" ne "" goto return
-
- call rand Rand
- set row=%@eval[%Rand/2147483646]
- call rand Rand
- set col=%@eval[%Rand/2147483646]
-
- iff "%p_size" eq "" then
- set row=%@int[%@eval[%[row]*%_rows]]
- set col=%@int[%@eval[%[col]*%_columns]]
- else
- set row=%@int[%@eval[%[row]*(%p_size*2-1)+(%_rows/2)-%p_size]]
- set col=%@int[%@eval[%[col]*%p_size*2+(%_columns/2)-%p_size]]
- endiff
-
- screen %row %col
- set char=%@ascii[%@readscr[%row,%col,1]]
- set char=%@eval[%@index[%[chars],%[char]]/4]
- iff %char lt 0 then
- set char=0
- elseiff %char ge 3 then
- set bg_str=%@word[-0,foo %_fg]
- iff "%_fg" eq "bri Bla" then
- set fg_str=Whi
- elseiff "%_fg" eq "Whi" then
- set fg_str=bri Whi
- else
- beep
- beep
- pause > nul
- endiff
- set char=0
- else
- set fg_str=%_fg
- set bg_str=%_bg
- set char=%@eval[%char+1]
- endiff
- set char=%@char[%@word[%[char],%[chars]]]
- scrput %row %col %fg_str on %bg_str %char
-
- goto testloop
-
- :return
- screen %ORow %OCol
-