:: Batch for analysing individual warriors in a score log. :: Note - warriorstring is case sensitive and must be one word, :: next word is treated as an output filename. As long as it :: matches a warrior name it's ok, blank screen means not present. :: If only logfile specified (like dropping a logfile on the icon) :: then it prompts for warriorstring and opt outfile until enter. :: If the warriorstring happens to be a valid filename (as with :: the evolved warriors) it is listed after the ratings. :: This batch requires QBasic.exe @echo off if .%1==. echo INSPECTS scorefile [warrior [outfile]] if .%1==. echo lists performance of a warrior in a pmars log if .%1==. echo if warrior not specified prompts for warrior [outfile] if .%1==. goto quit if not exist %1 echo scorefile not found if not exist %1 goto quit if .%2==. goto select set outfile=%1 set bpos=first echo Display both battle positions? choice /cny>nul if errorlevel 2 set bpos=both echo>rank$.bas :on error goto X ::figure out rounds echo>>rank$.bas open "%outfile%" for input as #1 echo>>rank$.bas B:line input #1,a$:if instr(a$, "Results:")=0 goto B echo>>rank$.bas close #1:x=instr(a$," "):y=instr(x+1,a$," ") echo>>rank$.bas z=instr(y+1,a$," "):q=val(mid$(a$,x,y-x)) echo>>rank$.bas r=val(mid$(a$,y,z-y)):s=val(right$(a$,len(a$)-z)) echo>>rank$.bas rounds=q+r+s:if rounds=0 goto X ::find all matching battles echo>>rank$.bas open "%outfile%" for input as #1 echo>>rank$.bas open "rank$.out" for output as #2 echo>>rank$.bas ? #2, "Battle details for warrior %2":? #2,"" echo>>rank$.bas ? #2, "Opponent Scores Results Performance of %2" echo>>rank$.bas ? #2, "-------- ------ ------- ---------=---------=---------=---------=" echo>>rank$.bas L:line input #1,a$:if instr(a$,"scores ")=0 goto L echo>>rank$.bas line input #1,b$:line input #1,c$ echo>>rank$.bas if instr(a$,"%2") goto P if %bpos%==first goto 1stonly echo>>rank$.bas if instr(b$,"%2") goto Q :1stonly echo>>rank$.bas goto L echo>>rank$.bas P:w$=left$(b$,instr(b$," by ")) echo>>rank$.bas w$=left$(w$+" ",15)+" " echo>>rank$.bas ms=val(right$(a$,len(a$)-instr(a$,"scores ")-6)) echo>>rank$.bas os=val(right$(b$,len(b$)-instr(b$,"scores ")-6)) echo>>rank$.bas goto R echo>>rank$.bas Q:w$=left$(a$,instr(a$," by ")) echo>>rank$.bas w$=left$(w$+" ",15)+" " echo>>rank$.bas ms=val(right$(b$,len(b$)-instr(b$,"scores ")-6)) echo>>rank$.bas os=val(right$(a$,len(a$)-instr(a$,"scores ")-6)) echo>>rank$.bas R:ms$=left$(str$(ms)+" ",4) echo>>rank$.bas os$=left$(str$(os)+" ",4) echo>>rank$.bas re$=right$(c$,len(c$)-8) echo>>rank$.bas re$=left$(re$+" ",12) echo>>rank$.bas ? #2,w$;os$;ms$;" ";re$; echo>>rank$.bas if os+ms=0 or ms=0 goto N :: changed formula, no-win ties now rank 33% echo>>rank$.bas ra=(ms/(rounds*3))*40 echo>>rank$.bas for z=1 to ra:? #2,"*";:next z echo>>rank$.bas N:? #2,"":goto L echo>>rank$.bas X:? #2, "-------- ------ ------- ---------=---------=---------=---------=" echo>>rank$.bas close #1:close #2:system qbasic /run rank$.bas del rank$.bas if not exist %2 goto listout echo.>>rank$.out echo %2 listing...>>rank$.out type %2>>rank$.out :listout list rank$.out if not .%3==. copy rank$.out %3>nul del rank$.out for %%a in (str bpos outfile) do set %%a= goto quit :select echo. echo. if exist enter.bat echo input disabled - remove ENTER.BAT file if exist enter.bat goto quit echo Enter warriorstring [outfile]... > en#er.bat fc con nul /lb1 /n|date|find " 1: " > enter.bat echo set str= >>enter.bat echo :loop >>enter.bat echo if not .%%str%%==. set str=%%str%% %%5 >>enter.bat echo if .%%str%%==. set str=%%5 >>enter.bat echo shift >>enter.bat echo if not .%%5==. goto loop call en#er.bat for %%a in (enter.bat en#er.bat) do del %%a if .%str%==. goto quit call %0 %1 %str% goto select :quit