@echo off REM Redcode to RedMaker converter - 8/31/00 WTN if .%2==. goto help if exist %1 goto start echo Error: file not found :help echo Usage: %0 infile outfile [Name] echo infile = existing redcode file echo outfile = redmaker file to create echo name = 4 char redmaker name (default=AaAa) echo Note - ORG/END x not supported! echo QBASIC and PMARS must be on path goto end :start REM *** trim comments, replace with ;assert 1 echo ;assert 1> rmconv.tmp type %1 | find/v ";" >> rmconv.tmp REM *** use pmars to generate listing pmars rmconv.tmp > rclist.tmp del rmconv.tmp set name=%3 if .%name%==. set name=AaAa REM *** generate qbasic convert program echo> conv_.bas :on error goto done echo>>conv_.bas open "rclist.tmp" for input as #1 echo>>conv_.bas open "%2" for output as #2 echo>>conv_.bas line input #1,a$ echo>>conv_.bas line input #1,a$ 'skip 1st 3 lines echo>>conv_.bas line input #1,a$ echo>>conv_.bas ?#2,";RedMaker Warrior" echo>>conv_.bas ?#2,";name %name%" echo>>conv_.bas ?#2,";assert 1" echo>>conv_.bas fileloop: line input #1,a$ echo>>conv_.bas if a$="" goto finish echo>>conv_.bas i$=lcase$(mid$(a$,8,6)) echo>>conv_.bas a1$=mid$(a$,15,1) echo>>conv_.bas d1=val(mid$(a$,17,5)) echo>>conv_.bas a2$=mid$(a$,24,1) echo>>conv_.bas d2=val(mid$(a$,26,5)) echo>>conv_.bas ?#2,i$;" ";a1$;left$(str$(d1)+" ",5); echo>>conv_.bas ?#2,", ";a2$;left$(str$(d2)+" ",5) echo>>conv_.bas goto fileloop echo>>conv_.bas finish: ?#2,"end" REM ** add comments to end for RM 2.83 echo>>conv_.bas close #1:open "%1" for input as #1 echo>>conv_.bas n$="unknown":while eof(1)=0:line input #1,a$ echo>>conv_.bas if left$(a$,6)=";name " then n$=right$(a$,len(a$)-6) echo>>conv_.bas wend: ?#2,";origin ";n$:?#2,";generation 0" echo>>conv_.bas ?#2,";battles 0":?#2,";score 0" echo>>conv_.bas done: close:system REM *** run qbasic program qbasic /run conv_.bas REM *** delete temp files del rclist.tmp del conv_.bas REM *** see if it worked if exist %2 echo RedMaker file %2 created. if not exist %2 echo Failed. :end