home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 199 / 4RANDOM.ZIP / RANDART.BTM < prev    next >
Encoding:
Text File  |  1992-10-20  |  1.9 KB  |  79 lines

  1. @echo off
  2.  
  3. REM This batch file creates a test pattern on screen using RAND.btm
  4. REM pseudo-random function. First we get random coordinates in range
  5. REM ([0,%_rows] [0,%_columns]), then lighten the character in the
  6. REM position a bit. The result will be a nice (random-like) pattern
  7. REM (hopefully not) characterising the RAND function itself.
  8.  
  9. setlocal
  10. unalias *
  11. set ORow=%_row
  12. set OCol=%_column
  13.  
  14. @if "%debug" ne "%0" @echo off
  15. set chars=176 177 178 219
  16. set fg_str=bri Bla
  17. set bg_str=Bla
  18.  
  19. REM Actual pattern width and hight will be p_size*2
  20. REM Comment the line below to use the hole screen
  21. set p_size=5
  22.  
  23. iff "%p_size" ne "" then
  24.  set coords=%@int[%@eval[%_rows/2-%p_size-1]]
  25.  set coords=%[coords] %@int[%@eval[%_columns/2-%p_size-1]]
  26.  set coords=%[coords] %@int[%@eval[%_rows/2+%p_size]]
  27.  set coords=%[coords] %@int[%@eval[%_columns/2+%p_size]]
  28.  drawbox %[coords] 1 Bri Whi on Bla FILL Bla
  29. else
  30.  cls Bri Bla on Bla
  31. endiff
  32.  
  33. :testloop
  34. inkey /w0 %%a
  35. if "%a" ne "" goto return
  36.  
  37. call rand Rand
  38. set row=%@eval[%Rand/2147483646]
  39. call rand Rand
  40. set col=%@eval[%Rand/2147483646]
  41.  
  42. iff "%p_size" eq "" then
  43.  set row=%@int[%@eval[%[row]*%_rows]]
  44.  set col=%@int[%@eval[%[col]*%_columns]]
  45. else
  46.  set row=%@int[%@eval[%[row]*(%p_size*2-1)+(%_rows/2)-%p_size]]
  47.  set col=%@int[%@eval[%[col]*%p_size*2+(%_columns/2)-%p_size]]
  48. endiff
  49.  
  50. screen %row %col
  51. set char=%@ascii[%@readscr[%row,%col,1]]
  52. set char=%@eval[%@index[%[chars],%[char]]/4]
  53. iff %char lt 0 then
  54.  set char=0
  55. elseiff %char ge 3 then
  56.  set bg_str=%@word[-0,foo %_fg]
  57.  iff "%_fg" eq "bri  Bla" then
  58.   set fg_str=Whi
  59.  elseiff "%_fg" eq      "Whi" then
  60.   set fg_str=bri Whi
  61.  else
  62.   beep
  63.   beep
  64.   pause > nul
  65.  endiff 
  66.  set char=0
  67. else
  68.  set fg_str=%_fg
  69.  set bg_str=%_bg
  70.  set char=%@eval[%char+1]
  71. endiff
  72. set char=%@char[%@word[%[char],%[chars]]]
  73. scrput %row %col %fg_str on %bg_str %char
  74.  
  75. goto testloop
  76.  
  77. :return
  78. screen %ORow %OCol
  79.