@echo off setlocal EnableDelayedExpansion set x=2 set y=1 set lvl=1-3 set yvar=40 color 07 REM .02*(Xvar*Yvar)=Amount of time to load REM Starting load :start set oldtime=%time% ECHO %Time% >> timer.txt set x=2 set y=1 for /f "tokens=%x%" %%a in ('findstr xvar lvl%lvl%.txt') do set xvar=%%a for /f "tokens=%x%" %%a in ('findstr yvar lvl%lvl%.txt') do set yvar=%%a for /f "tokens=%x%" %%a in ('findstr rend lvl%lvl%.txt') do set rend=%%a for /f "tokens=2" %%a in ('findstr doors lvl%lvl%.txt') do set doors%lvl%=%%a for /f "tokens=2" %%a in ('findstr nsos lvl%lvl%.txt') do set nsos%lvl%=%%a REM Finding non static icons and archiving their positions set oldy=%y% set y=2 :nsoaloop set /a yedit=%y%-1 set /a yedit2=%y%+1 for /f "tokens=2" %%a in ('findstr nso%yedit% lvl%lvl%.txt') do set nso[%lvl%, %yedit%, x]=%%a for /f "tokens=3" %%a in ('findstr nso%yedit% lvl%lvl%.txt') do set nso[%lvl%, %yedit%, y]=%%a for /f "tokens=4" %%a in ('findstr nso%yedit% lvl%lvl%.txt') do set nso[%lvl%, %yedit%, I]=%%a if %yedit% EQU !nsos%lvl%! goto nsoaloopend echo !nso[%lvl%, %yedit%, x]! echo !nso[%lvl%, %yedit%, y]! pause set /a y=%y%+1 goto nsoaloop :nsoaloopend set y=%oldy% REM Finding doors and archiving their positions set oldy=%y% set y=2 :doorloop set /a yedit=%y%-1 set /a yedit2=%y%+1 for /f "tokens=2" %%a in ('findstr door%yedit% lvl%lvl%.txt') do set door[%lvl%, %yedit%, x]=%%a for /f "tokens=3" %%a in ('findstr door%yedit% lvl%lvl%.txt') do set door[%lvl%, %yedit%, y]=%%a if %yedit% EQU !doors%lvl%! goto doorloopend set /a y=%y%+1 goto doorloop :doorloopend set y=%oldy% REM Finding room name for /f "tokens=2" %%a in ('findstr name lvl%lvl%.txt') do set room=%%a REM Finding length of room name set "myString=abcdef!%%^^()^!" call :strlen result room echo %result% goto :eof :strlen ( set "s=!%~2!#" set "len=0" for %%P in (4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do ( if "!s:~%%P,1!" NEQ "" ( set /a "len+=%%P" set "s=!s:~%%P!" ) ) ) ( set "%~1=%len%" ) REM Applying length of room name to find how long to make the title bar set x=1 set /a titlespace=30-%len%/2 set titlespacing=л :titlespacingloop if %x% GTR %titlespace% goto titlespacingend set titlespacing=л%titlespacing% set /a x=%x%+1 goto titlespacingloop :titlespacingend REM Judging whether or not the title is even, fixing if so set /a modulo="%result% %% 2" if %modulo% EQU 0 ( set arraytitle[%lvl%]=л%titlespacing%л%room%%titlespacing%л ) else ( set arraytitle[%lvl%]=л%titlespacing%%room%%titlespacing%л ) set load= set x=2 REM Guessing load time set /a calc=20*(%Xvar%*%Yvar%) echo Started loading at %oldtime% echo Estimated load time: %calc% ms goto arrayxloop REM Reading off of lvl and applying to array :arrayxloop set /a yedit=%y%+9 REM WORK ON THIS, ITS HORRIBLY INEFFICIENT \/\/\/ if %rend% EQU 0 for /f "tokens=%x%" %%a in ('findstr line%yedit% lvl%lvl%.txt') do set load=%%a REM Alternate rendering for spaces if %rend% EQU 1 for /f "tokens=%x% delims=-" %%a in ('findstr line%yedit% lvl%lvl%.txt') do set load=%%a set /a xedit=%x%-1 set array[%lvl%,%xedit%,%y%]=%load% set load= set /a loadtime=((%xedit%+((%y%-1)*%xvar%))*100)/(%xvar%*%yvar%) cls echo Loading new part of the world. echo Generating triangles... echo Percent complete:%loadtime% echo( echo Time initiated %oldtime% echo Current time: %time% echo Estimated time until completion: *shrugs shoulders* if %x% GTR %xvar% goto arrayyloop if %y% GTR %yvar% goto update set /a x=%x%+1 goto arrayxloop REM Preparing lvl read and array load for next line :arrayyloop set x=2 set /a y=%y%+1 goto arrayxloop REM Reading to lines :update REM reading x/yvar from lvl set x=2 for /f "tokens=%x%" %%a in ('findstr xvar lvl%lvl%.txt') do set xvar=%%a for /f "tokens=%x%" %%a in ('findstr yvar lvl%lvl%.txt') do set yvar=%%a REM making spaces for map on x axis set x=1 set /a mapspace=(30-%xvar%)/2 set mapspacing= :mapspacingloop if %x% GTR %mapspace% goto mapspacingend set mapspacing= %mapspacing% set /a x=%x%+1 goto mapspacingloop :mapspacingend REM Deleting previous y variables set y=1 :delyloop set line[%y%]= if %y% EQU %yvar% goto delloopend set /a y=%y%+1 goto delyloop :delloopend REM Preparing for readxloop set x=1 set y=1 goto readxloop REM Deciding and placing what digit to place on the x axis :readxloop if %x% GTR %xvar% goto readyloop if %y% GTR %yvar% goto finload REM Alternate loop to place NSO instead of terrain set nsovar=1 :nsoloop set tempvar=!nso[%lvl%, %nsovar%, x]! set tempvar2=!nso[%lvl%, %nsovar%, y]! if %x% EQU %tempvar% ( set /a tempvar=%tempvar%+1 if %y% EQU %tempvar2% ( set line[%y%]=!line[%y%]!!nso[%lvl%, %nsovar%, I]! set oldnso=%nsovar% set /a x=%x%+1 goto nsoloopditch ) ) if %nsovar% EQU !nsos%lvl%! goto nsoloopend set /a nsovar=%nsovar%+1 goto nsoloop :nsoloopend set line[%y%]=!line[%y%]!!array[%lvl%,%x%,%y%]! if %x% EQU 1 ( set /a modulo="%xvar% %% 2" if !modulo! EQU 0 ( set line[%y%]=%mapspacing%!array[%lvl%,%x%,%y%]! ) else ( set line[%y%]=%mapspacing% !array[%lvl%,%x%,%y%]! ) ) if %x% EQU %xvar% set line[%y%]=!line[%y%]!%mapspacing%л set /a x=%x%+1 :nsoloopditch goto readxloop REM Unused dev tools tp be placed in above loop set /a loadtime=((%xedit%+((%y%-1)*%xvar%))*100)/(%xvar%*%yvar%) cls echo Loading new part of the world. echo Putting the dirt in the ground echo Time untill Jesus: %loadtime% echo Planting NPC # %oldnso% of !nsos%lvl%! echo Time initiated %oldtime% echo Current time: %time% echo Estimated time until completion: *shrugs shoulders* REM Preparing the xloop for a new line :readyloop set x=1 set /a y=%y%+1 goto readxloop REM Finished load :finload REM Telling client that it has loaded the level set arrayload[%lvl%]=1 cls echo !arraytitle[%lvl%]! echo л set y=1 goto printyloop REM Printing lines :printyloop echo !line[%y%]! if %y% EQU %yvar% goto fin set /a y=%y%+1 goto printyloop :fin echo л echo ллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллл set x=2 for /f "tokens=%x%" %%a in ('findstr rend lvl%lvl%.txt') do set rend=%%a echo x:%x% y:%y% xvar:%xvar% yvar:%yvar% calc:%calc% input:%input% rend:%rend% echo Initiated loading at: %oldtime% Completed loading at: %time% echo Enter Input (WASDT): goto lvlselect choice /c wasdt /n if %errorlevel% equ 1 set input=w if %errorlevel% equ 2 set input=a if %errorlevel% equ 3 set input=s if %errorlevel% equ 4 set input=d if %errorlevel% equ 5 goto dev goto finload :dev echo L: Level Select R: Read Co-ords echo T: Close Dev Tools choice /c lrt /n if %errorlevel% equ 1 goto lvlselect if %errorlevel% equ 2 echo [UNFINISHED] if %errorlevel% equ 3 goto update pause goto finload :lvlselect set /p choice="LvL?..." set oldtime=%time% ECHO Start Measure %Time% >> timer.txt if %choice% == %lvl% goto finload set lvl=%choice% if !arrayload[%lvl%]! EQU 1 goto update goto start