REM Dump a RedMixer soup as an ANSI file  3/2/09 WTN
REM set these to soup size... (min 10x10 max 99x99)
ysize = 21: xsize = 77
REM set these to adjust the coloring scheme...
cshift = 0: xmult = 1: ymult = 21
ON ERROR GOTO badfile
LINE INPUT "Soup directory   : "; soup$
soup$ = LTRIM$(RTRIM$(soup$)): IF soup$ = "" GOTO done
LINE INPUT "ANSI output file : "; ansi$
ansi$ = LTRIM$(RTRIM$(ansi$)): IF ansi$ = "" GOTO done
OPEN ansi$ FOR OUTPUT AS #3
PRINT #3, CHR$(27); "[H.";
FOR i = 1 TO xsize: PRINT #3, "-"; : NEXT i
PRINT #3, "."
FOR y = 1 TO ysize
 PRINT #3, "|";
 FOR x = 1 TO xsize
  species$ = "00_00": warlen = 0
  yn$ = RIGHT$("0" + LTRIM$(RTRIM$(STR$(y))), 2)
  xn$ = RIGHT$("0" + LTRIM$(RTRIM$(STR$(x))), 2)
  f$ = soup$ + "\" + yn$ + "_" + xn$ + ".red"
  OPEN f$ FOR INPUT AS #1
  WHILE NOT EOF(1)
   LINE INPUT #1, a$
   IF LEFT$(a$, 9) = ";species " THEN species$ = MID$(a$, 10)
   IF MID$(a$, 4, 1) = "." THEN warlen = warlen + 1
  WEND
  CLOSE #1
  yc = VAL(LEFT$(species$, 2))
  xc = VAL(MID$(species$, 4, 2))
  ansicolor = ((cshift + yc * ymult + xc * xmult) MOD 14) + 31
  PRINT #3, CHR$(27); "[";
  IF ansicolor > 37 THEN
   PRINT #3, "1;"; : ansicolor = ansicolor - 8
  ELSE
   PRINT #3, "0;";
  END IF
  PRINT #3, LTRIM$(RTRIM$(STR$(ansicolor))); "m";
  s = warlen
  char$ = CHR$(126)
  IF s > 0 AND s < 10 THEN char$ = CHR$(s + 48)
  IF s > 9 AND s < 36 THEN char$ = CHR$(s + 55)
  IF s > 35 AND s < 62 THEN char$ = CHR$(s + 61)
  IF s > 61 AND s < 77 THEN char$ = CHR$(s - 29)
  IF s > 76 AND s < 84 THEN char$ = CHR$(s - 19)
  IF s > 83 AND s < 87 THEN char$ = CHR$(s + 39)
  PRINT #3, char$;
 NEXT x
 PRINT #3, CHR$(27); "[0m"; "|"
NEXT y
PRINT #3, "`";
FOR i = 1 TO xsize: PRINT #3, "-"; : NEXT i
PRINT #3, "'"
CLOSE #3
GOTO done
badfile:
CLOSE
PRINT "Error."
done:
SYSTEM

