Heres the batch im making
Code: Select all
@echo off
SetLocal EnableDelayedExpansion
echo ---------------------------------------------------------
echo Pyromaniac's vmt creator!
echo ---------------------------------------------------------
set filefound= No files were missing!
set usrdir=C:\Steam\steamapps\pyromaniac1444\half-life 2\hl2\materials\
call :getlength "%usrdir%" length
cd C:\Steam\steamapps\pyromaniac1444\half-life 2\hl2\materials\
echo Searching...
for /f "tokens=*" %%A in ('dir *.vtf /s /b') do (
set list=%%~fA
echo Scanning %%~nA...
if not exist %%~pnA.vmt (
set filefound= Missing vmt's were found and generated.
echo "VertexLitGeneric" > %%~pnA.vmt
echo { >> %%~pnA.vmt
set list=%list:~-%length%%
echo "$basetexture" "%list%" >> %%~pnA.vmt
echo } >> %%~pnA.vmt
echo Missing vmt for file %%~nA.
)
)
echo ---------------------------------------------------------
echo File creation is complete!
echo %filefound%
echo ---------------------------------------------------------
:getlength
SetLocal
set len=0
set str=%~1
if not defined str goto :eof
set str=%str:"=.%987654321
:loop
if not "%str:~18%"=="" set str=%str:~9%& set /a len+=9& goto loop
set num=%Str:~9,1%
set /a len=len+num
EndLocal&set %2=%len%&goto :eof