• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How to use an batch file to run your server [Tibia 12 issues]

Joriku

Working in the mines, need something?
Joined
Jul 16, 2016
Messages
1,078
Solutions
15
Reaction score
370
Location
Sweden
YouTube
Joriku
Alright, so after hours and hours of work. I finally found an creative solution for OT 12 users or any other user for that matter that uses an auto restarter. This is not the best and can be developed futher.

MODS: If this is the wrong, just switch it. I couldn't find an post corner for this one.

Alright, what it does:
I asked around everywhere here on otland, and people i Know and everyone came back with the same answer. It's not possible... Well in your face, here it is.
Due to client.exe can't be moved out of "bin" folder, this is an solution to run your file anyways without moving it or make your auto updater run your file.
Here's my updater:
dcfe8f20656bd7ee22d8b803fdd8f5ce.png


Note how i have a cfg for later folder for later.
Alright, it's automatically downloading the files (Auto updater..)
Note ConfigFilesDesktop/Downloads and Start.bat
c2cd510a2f9eebe5d9bb66a44ea6f04e.png


Here's where the "magic" begins, and this is made with batch due to my c++ knowledge being trash like many others. So if you even dare to comment that it's useless, salamaleko i ban u .I.
Inside the start.bat:
Here we got some modifications, what this does.
Simple, it checks for downloads/desktop location of the "userprofile" and saves your cfg which i just discovered is deleted every time an update gets released. Here's where the "cfg" folder comes to use.
Lua:
echo off
timeout 1 > NUL
echo Restoring your config files, please wait..
:file_checkrestore
if exist "%USERPROFILE%\desktop\Hoxera\Build\ConfigFilesDesktop.bat" (goto file_existscfg) else (timeout /t 1 /nobreak > output)
(goto file_checkrestore1)

:file_existscfg
START %USERPROFILE%\desktop\Hoxera\Build\ConfigFilesDesktop.bat
timeout 1 > NUL
echo current time: %time%
echo waiting for config files..
timeout 6 > NUL
(goto file_check)

:file_checkrestore1
if exist "%USERPROFILE%\downloads\Hoxera\Build\ConfigFilesDownloads.bat" (goto file_existscfg1) else (timeout /t 1 /nobreak > output)
(goto file_noexistcfg)

:file_existscfg1
START %USERPROFILE%\downloads\Hoxera\Build\ConfigFilesDownloads.bat
timeout 1 > NUL
echo current time: %time%
echo waiting for config files..
timeout 6 > NUL
(goto file_check)

:file_noexistcfg
echo Failed to find ConfigFiles.bat, please contact an Administrator over at our discord for support.
pause
exit

echo off

:file_check
if exist "%USERPROFILE%\desktop\Hoxera\Build\bin\Hoxera.exe" (goto file_exists) else (timeout /t 1 /nobreak > output)
(goto file_check1)

:file_check1
if exist "%USERPROFILE%\downloads\Hoxera\Build\bin\Hoxera.exe" (goto file_exists1) else (timeout /t 1 /nobreak > output)
(goto file_noexist)

:file_exists
START %USERPROFILE%\desktop\Hoxera\Build\bin\Hoxera.exe
(goto file_exist)

:file_exists1
START %USERPROFILE%\downloads\Hoxera\Build\bin\Hoxera.exe
(goto file_exist)

:file_noexist
echo Failed to find Hoxera.exe, please. Go to https://hoxera.com/ to read more about this at the Downloads section.
pause

:file_exist

Here it checks for the location of "Hoxera" and it's files, launches up either desktop or downloads and runs the ConfigFIles.bat to automatically save your old config and replace it as a backup for updates. It does this everytime you use "Start.bat".
This is a workaround for auto-update and config issues.

ConfigFiles.bat:
Lua:
echo off
echo Copying clientoptions.json..
echo f | xcopy /s/y %USERPROFILE%\desktop\Hoxera\Build\conf\clientoptions.json %USERPROFILE%\desktop\Hoxera\cfg\clientoptions.json

timeout 1 > NUL

echo Copying clientoptions.json..
echo f | xcopy /s/y %USERPROFILE%\desktop\Hoxera\cfg\clientoptions.json %USERPROFILE%\desktop\Hoxera\Build\conf\clientoptions.json
exit
 
Nice, it should go into Tutorials part of the forums IMO.
My bad, did not find a suiting place for this..
Thanks for commenting onto it, hope it was done well! :D
 
Alright, after hard work and much re-search and help from @Boy67 I am finally proud to say that I got up a later more suitable version of this.
Here it comes, this one checks the dir where the batch file has been ran from and executes from it's direction.
Also, saves config into a folder called CFG and releases it into the conf folder again. This is to avoid resetting player's config files every time they download an new update.
Enjoy, this is a way of avoiding players needing to enter bin folder(s) and/or download new clients all the time for people who wants to use Tibia 11-12x clients and avoid the hard parts.


Version 2.0
File: Start.bat
Where it says: Hoxera, replace it with your Tibia.exe file.
Lua:
@echo off

:config
IF EXIST ConfigFiles.bat goto config_exists
IF NOT EXIST ConfigFiles.bat goto statistics_conf

:config_exists
echo Everything seems to be correct, please wait while we boot up the config handler..
timeout 1 > NUL
start ConfigFiles.bat
goto hoxera

:statistics_conf
timeout 3 > NUL
echo Could not locate ConfigFiles.bat, did you change the name of the Hoxera folder? If not, contact us over at our discord for support.
pause

:hoxera
IF EXIST bin\hoxera.exe goto hoxera_exists
IF NOT EXIST bin\hoxera.exe goto statistics

:hoxera_exists
echo Waiting a few seconds before continuing..
timeout 5 > NUL
echo Everything seems to be correct, please wait while we start up the game client..
timeout 1 > NUL
start bin\hoxera.exe
goto exit

:statistics
timeout 3 > NUL
echo Could not locate Hoxera.exe, did you change the name of the Hoxera folder? If not, contact us over at our discord for support.
pause

:exit

File: ConfigFile.bat
Lua:
echo off
echo Copying clientoptions.json..
echo f | xcopy /s/y/f "%~dp0\conf\clientoptions.json" "%~dp0..\cfg\clientoptions.json"

timeout 1 > NUL

echo Pasting clientoptions.json..
echo f | xcopy /s/y/f "%~dp0..\cfg\clientoptions.json" "%~dp0\conf\clientoptions.json"
exit
 
Back
Top