Thread: Am I crazy? >_<
View Single Post
  #86  
Old 07-23-2009, 10:32 AM
nosfentora
Discordant
 
Join Date: Oct 2004
Location: In a house
Posts: 387
Default

I had written this batch code to do something like what Shendare did, though it doesn't restore the original after exit, but it does make a backup of it in the same folder as the batch file. The loadscreens can be in any folder, as can be the batch file. Just edit the section 'EDIT THESE', save and run.

I use it in conjunction with my client launcher that i wrote, which launches the eq client, and auto-sets the processor affinity to 0, to alleviate any multi-core issues that multi-core procs have.


Code:
@echo off
cls

REM ***** EDIT THESE (DON'T USE QUOTES AROUND LONG FOLDER NAMES!)
set EQ_DIR=D:\INSTALLS\EverQuest\Sof\
set LOADSCREEN_SOURCE_DIR=C:\Servers\EQ\Apps\Loadscreen Changer\Loadscreens\
set LAUNCHER_DIR=C:\Servers\EQ\Apps\ClientLauncher\
set USE_LAUNCHER=y
REM ***** DON'T NEED TO EDIT ANYTHING ELSE

set EQ_RESOURCE_DIR=%EQ_DIR%Resources\


set ok=n
call :calc_loadscreens
if exist "%EQ_RESOURCE_DIR%" if exist "%LOADSCREEN_SOURCE_DIR%" if exist "%LOADSCREEN_SOURCE_DIR%loadscreen*.*" if %loadscreen_count% geq 1 set ok=y

if %ok%==n goto :missing_resources

call :backup_original
call :copy_new_screen

if /i %USE_LAUNCHER%==y if not exist "%LAUNCHER_DIR%EQLauncher.exe" set USE_LAUNCHER=n
if /i %USE_LAUNCHER%==Y start /d"%LAUNCHER_DIR%" EQLauncher.exe

goto :eof

:missing_resources
echo Missing something somewhere!
echo Check that your paths are correct and that the loadscreens are present.
echo.
echo EQ Resource Dir = %EQ_RESOURCE_DIR%
echo Loadscreen Dir = %LOADSCREEN_SOURCE_DIR%
echo.
echo Loadscreens found = %loadscreen_count% & pause
goto :eof

:calc_loadscreens
set loadscreen_count=0
if not exist "%LOADSCREEN_SOURCE_DIR%" goto :eof
for %%a in (dir "%LOADSCREEN_SOURCE_DIR%load*.*") do set /a loadscreen_count=loadscreen_count+1
goto :eof

:gen_random_image
:gen_random
Set /a Number=(%Random% %%%loadscreen_count%)+1
set image=loadscreen%Number%.jpg
if not exist "%LOADSCREEN_SOURCE_DIR%%image%" goto :gen_random
goto :eof

:backup_original
if not exist "%LOADSCREEN_SOURCE_DIR%loadscreen_original.jpg" if exist ".\loadscreen.jpg" copy "%EQ_RESOURCE_DIR%loadscreen.jpg" ".\loadscreen_original.jpg"
goto :eof

:copy_new_screen
call :gen_random_image
if exist "%EQ_RESOURCE_DIR%loadscreen.jpg" del "%EQ_RESOURCE_DIR%loadscreen.jpg" /q
copy "%LOADSCREEN_SOURCE_DIR%%image%" "%EQ_RESOURCE_DIR%loadscreen.jpg%"
goto :eof
Reply With Quote