Temporate .bat scripts for switching mods before modselect

Temporate .bat scripts for switching mods before modselect

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
Cheery
Posts: 129
Joined: 09 May 2005, 10:30

Temporate .bat scripts for switching mods before modselect

Post by Cheery »

I made very simple scripts that I could switch different mods quickly in TASpring. I think you people could have use from them too.

Copy&paste the script into the corresponding text-file.

Code: Select all

AA_on.bat

rename taenheter.ccx taenheter.old
rename AbsoluteAnnihilation.old AbsoluteAnnihilation.ccx

AA_off.bat

rename taenheter.old taenheter.ccx
rename AbsoluteAnnihilation.ccx AbsoluteAnnihilation.old 

EvOTA_on.bat
rename Objects3Dold Objects3D
rename OTA_settings_for_spring_patch.ufo.old OTA_settings_for_spring_patch.ufo

EvOTA_off.bat
rename Objects3D Objects3Dold
rename OTA_settings_for_spring_patch.ufo OTA_settings_for_spring_patch.ufo.old

Before you can use them. install the AA and EvOTA mods, then run EvOTA_off and AA_off, then you should be able to change the mod easily by running them before you join into game.

I made quick menu shortcuts for these on my start bar so I can change them in fly. I hope this helps somebody. :)

ps. You don't have to restart the client, only rejoin, if you have the wrong mod and you change it.
User avatar
genblood
Posts: 862
Joined: 19 Jan 2005, 03:37

Post by genblood »

.

.. Cool ... 8)

Great ... idea ... :idea:


Just add 4 shortcuts to your desktop and you will
be able to switch between the mods ....
User avatar
Cheery
Posts: 129
Joined: 09 May 2005, 10:30

Post by Cheery »

:D Put them into a folder or start -bar. Not on to the desktop.

And it's worth of it to have 5 icons about TA on your desktop anyway. :)
User avatar
Gabba
Posts: 319
Joined: 08 Sep 2004, 22:59

Post by Gabba »

I see a potential problem for non-expert users: what if you don't remember what mod is on/off? Maybe you could modify your .bat files to automatically detect that
User avatar
Cheery
Posts: 129
Joined: 09 May 2005, 10:30

Post by Cheery »

I had happened that for myself many times, thought I found out that the files are safe to try again and again.

I think I could do that if I would find that bat reference from somewhere. Some conditional statements should do the job.
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

Something like "if exists" maybe?
Check if there is an .old file with a name, and if dos, rename it. Or something. I don't remember the correct syntax for batch commands anymore.
User avatar
Michilus_nimbus
Posts: 634
Joined: 19 Nov 2004, 20:38

Post by Michilus_nimbus »

Sean Mirrsen wrote:Something like "if exists" maybe?
Check if there is an .old file with a name, and if dos, rename it. Or something. I don't remember the correct syntax for batch commands anymore.
I'm on it.
I'll post it as soon as is can.
User avatar
Gabba
Posts: 319
Joined: 08 Sep 2004, 22:59

Post by Gabba »

Michilus_nimbus wrote:
Sean Mirrsen wrote:Something like "if exists" maybe?
Check if there is an .old file with a name, and if dos, rename it. Or something. I don't remember the correct syntax for batch commands anymore.
I'm on it.
I'll post it as soon as is can.
Great. If you find a good reference on batch file syntax, can you post the link here? I'd like to "get a refresh" on that.
jouninkomiko
Posts: 436
Joined: 26 Aug 2004, 08:11

Post by jouninkomiko »

User avatar
Cheery
Posts: 129
Joined: 09 May 2005, 10:30

Post by Cheery »

Ok, maybe these ones are more intelligent than the four before:

Mods.bat

Code: Select all

@ECHO OFF
IF EXIST taenheter.ccx ECHO XTA: on.
IF EXIST taenheter.old ECHO XTA: off.
IF EXIST AbsoluteAnnihilation.ccx ECHO AA: on.
IF EXIST AbsoluteAnnihilation.old ECHO AA: off.
IF EXIST Objects3Dold IF EXIST OTA_settings_for_spring_patch.ufo.old ECHO EvOTA: off
IF EXIST Objects3D IF EXIST OTA_settings_for_spring_patch.ufo ECHO EvOTA: on
pause
EvOTA.bat

Code: Select all

@ECHO OFF
IF EXIST Objects3Dold IF EXIST OTA_settings_for_spring_patch.ufo.old GOTO On
IF EXIST Objects3D IF EXIST OTA_settings_for_spring_patch.ufo GOTO Off

GOTO End
:On
ECHO EvOTA - on
IF EXIST AbsoluteAnnihilation.ccx CALL AA.bat /NOPAUSE
rename Objects3Dold Objects3D
rename OTA_settings_for_spring_patch.ufo.old OTA_settings_for_spring_patch.ufo
GOTO End
:Off
ECHO EvOTA - off
rename Objects3D Objects3Dold
rename OTA_settings_for_spring_patch.ufo OTA_settings_for_spring_patch.ufo.old
:End
IF [%1]==[/NOPAUSE] GOTO Over
pause
:Over
AA.bat

Code: Select all

@ECHO OFF

IF EXIST taenheter.ccx IF EXIST AbsoluteAnnihilation.old GOTO On
IF EXIST taenheter.old IF EXIST AbsoluteAnnihilation.ccx GOTO Off

GOTO End
:On
ECHO XTA - off
ECHO AA  - on
IF EXIST Objects3D IF EXIST OTA_settings_for_spring_patch.ufo CALL EvOTA.bat /NOPAUSE
rename taenheter.ccx taenheter.old
rename AbsoluteAnnihilation.old AbsoluteAnnihilation.ccx
GOTO End
:Off
ECHO XTA - on
ECHO AA  - off
rename taenheter.old taenheter.ccx
rename AbsoluteAnnihilation.ccx AbsoluteAnnihilation.old 
:End
IF [%1]==[/NOPAUSE] GOTO Over
pause
:Over
User avatar
Michilus_nimbus
Posts: 634
Joined: 19 Nov 2004, 20:38

Post by Michilus_nimbus »

Nice cheery!
I made this little thingie:

Code: Select all

@echo off
echo Which mod/settings would you like to use?
echo 1.Standard XTA
echo 2.evOTA2
echo 3.Absolute Annihilation
echo 4.Enable/Disable EVOLVA models
set /p ind=">"
if %ind% == 1 goto xta
if %ind% == 2 goto evo
if %ind% == 3 goto aa
if %ind% == 4 goto olva
:xta
if exist taenheter.ccx rename taenheter.ccx taenheter.hpi
if exist AbsoluteAnnihilation.ccx rename AbsoluteAnnihilation.ccx AbsoluteAnnihilation.old
if exist OTA_settings_for_spring_patch.ufo rename OTA_settings_for_spring_patch.ufo OTA_settings_for_spring_patch.ufo.old
echo XTA enabled succesfully. Carry on now!
pause
goto end
:evo
if exist taenheter.ccx rename taenheter.ccx taenheter.hpi
if exist OTA_settings_for_spring_patch.ufo.old rename OTA_settings_for_spring_patch.ufo.old OTA_settings_for_spring_patch.ufo
if exist AbsoluteAnnihilation.ccx rename AbsoluteAnnihilation.ccx AbsoluteAnnihilation.old
echo evOTA2 enabled succesfully. Carry on now!
pause
goto end
:aa
if exist taenheter.hpi rename taenheter.hpi taenheter.ccx
if exist AbsoluteAnnihilation.old rename AbsoluteAnnihilation.old AbsoluteAnnihilation.ccx
echo Absolute Annihilation enabled succesfully. Carry on now!
pause
goto end
:olva
if exist Objects3D goto dis
if exist Objects3Dold goto ena
:dis
rename Objects3D Objects3Dold
echo EVOLVA Models disabled succesfully. Carry on now!
pause
goto end
:ena
rename Objects3Dold Objects3D
echo EVOLVA models enabled succesfully. Carry on now!
pause
:end
I guess it isn't nearly as efficient as yours...
User avatar
Cheery
Posts: 129
Joined: 09 May 2005, 10:30

Post by Cheery »

Thanks, but your code is not bad at all.

Michilus, I think we could research it a little more to get what we want...

modman.bat

Code: Select all

@echo off

:start
cls
echo modman
echo Temporate mod manager program for TASpring.
echo -
echo Your TASpring mod status:

if exist taenheter.ccx if not exist OTA_settings_for_spring_patch.ufo echo Standard XTA enabled.
if exist AbsoluteAnnihilation.ccx echo Absolute Annihilation enabled.
if exist OTA_settings_for_spring_patch.ufo echo evOTA2 enabled.
if exist Objects3D echo EVOLVA models enabled.
if exist Objects3Dold echo EVOLVA models disabled.

echo Which mod/settings would you like to use?
echo q.Exit modman
if exist taenheter.old echo x.Standard XTA
if exist OTA_settings_for_spring_patch.ufo echo x.Standard XTA
if exist OTA_settings_for_spring_patch.ufo.old echo e.evOTA2
if exist AbsoluteAnnihilation.old echo a.Absolute Annihilation
if exist Objects3Dold echo o.Enable EVOLVA models
if exist Objects3D echo o.Disable EVOLVA models

set /p ind=">"
if %ind% == x goto xta
if %ind% == e goto evo
if %ind% == a goto aa
if %ind% == o goto olva

if not %ind% == q goto start
goto end

:xta
if exist taenheter.old rename taenheter.old taenheter.ccx
if exist AbsoluteAnnihilation.ccx rename AbsoluteAnnihilation.ccx AbsoluteAnnihilation.old
if exist OTA_settings_for_spring_patch.ufo rename OTA_settings_for_spring_patch.ufo OTA_settings_for_spring_patch.ufo.old

echo XTA enabled.
goto start

:evo
if exist OTA_settings_for_spring_patch.ufo.old rename OTA_settings_for_spring_patch.ufo.old OTA_settings_for_spring_patch.ufo
if exist AbsoluteAnnihilation.ccx rename AbsoluteAnnihilation.ccx AbsoluteAnnihilation.old
if exist taenheter.old rename taenheter.old taenheter.ccx

echo evOTA2 enabled.
goto start

:aa
if exist taenheter.ccx rename taenheter.ccx taenheter.old
if exist AbsoluteAnnihilation.old rename AbsoluteAnnihilation.old AbsoluteAnnihilation.ccx
if exist OTA_settings_for_spring_patch.ufo rename OTA_settings_for_spring_patch.ufo OTA_settings_for_spring_patch.ufo.old
echo Absolute Annihilation enabled.
goto start
:olva
if exist Objects3D goto dis
if exist Objects3Dold goto ena
:dis
rename Objects3D Objects3Dold
echo EVOLVA Models disabled.
goto start
:ena
rename Objects3Dold Objects3D
echo EVOLVA models enabled.
goto start
:end
I changed it behauvior and removed the 'succesfully' - text because there are no possibility it could fail. At least there doesn't read anywhere it could actually fail. The program doesn't need to talk anything more than it requires. :)

Now our mod manager
User avatar
Michilus_nimbus
Posts: 634
Joined: 19 Nov 2004, 20:38

Post by Michilus_nimbus »

Wonderfull!
I'm currently looking for an easy way to add mods.
Torrasque
Posts: 1022
Joined: 05 Oct 2004, 23:55

Post by Torrasque »

Cheery wrote:
I changed it behauvior and removed the 'succesfully' - text because there are no possibility it could fail. :)
They are always a possibility that it could fail.
User avatar
genblood
Posts: 862
Joined: 19 Jan 2005, 03:37

Post by genblood »

Hi ALL.

I figure I add a bat file too.

Code: Select all

@ECHO OFF
cls
IF EXIST taenheter.ccx ECHO Current setting for XTA is set to  [XTA: on]
IF EXIST taenheter.hpi ECHO Current setting for XTA is set to [XTA: off]
IF EXIST AbsoluteAnnihilation.ccx ECHO Current setting for AA Mod is set to [AA Mod: on]
IF EXIST AbsoluteAnnihilation.old ECHO Current setting for AA Mod is set to [AA Mod: off]
IF EXIST Objects3Dold IF EXIST OTA_settings_for_spring_patch.ufo.old ECHO Current setting for evOTAv2 [evOTAv2: off]
IF EXIST Objects3D IF EXIST OTA_settings_for_spring_patch.ufo ECHO Current setting for evOTAv2 [evOTAv2: on]
pause 

echo Do you want to change your current settings?
echo 1.Standard XTA Mod on
echo 2.evOTA2 Mod on
echo 3.Absolute Annihilation Mod on
echo 4.Standard XTA Mod off
echo 5.evOTAv2 Mod off
echo 6.Absolute Annihilation Mod off 
echo 7.exit
set /p ind=">"
if %ind% == 1 goto xta
if %ind% == 2 goto evo
if %ind% == 3 goto aa
if %ind% == 4 goto xtaoff
if %ind% == 5 goto evooff
if %ind% == 6 goto aaoff
if %ind% == 7 goto exit

:xta
if exist taenheter.hpi rename taenheter.hpi taenheter.ccx
if exist AbsoluteAnnihilation.ccx rename AbsoluteAnnihilation.ccx AbsoluteAnnihilation.old
if exist OTA_settings_for_spring_patch.old rename OTA_settings_for_spring_patch.old OTA_settings_for_spring_patch.ufo.old
IF EXIST Objects3D rename objects3d objects3dold
echo XTA Mod is set as you current default setting in TASpring.
pause
goto end  

:evo
if exist taenheter.ccx rename taenheter.ccx taenheter.hpi
if exist OTA_settings_for_spring_patch.ufo.old rename OTA_settings_for_spring_patch.ufo.old OTA_settings_for_spring_patch.ufo
if exist AbsoluteAnnihilation.ccx rename AbsoluteAnnihilation.ccx AbsoluteAnnihilation.old
IF EXIST Objects3Dold rename objects3dold objects3d
echo evOTAv2 Mod is set as you current default setting in TASpring.
pause
goto end 

:aa
if exist taenheter.hpi rename taenheter.hpi taenheter.ccx
if exist AbsoluteAnnihilation.old rename AbsoluteAnnihilation.old AbsoluteAnnihilation.ccx
echo Absolute Annihilation Mod is set as you current default setting in TASpring.
pause
goto end

:xtaoff
if exist taenheter.ccx rename taenheter.ccx taenheter.hpi
echo XTA Mod is set to "OFF" in your current default setting in TASpring.
pause
goto end

:evooff
if exist taenheter.ccx rename taenheter.ccx taenheter.hpi
if exist OTA_settings_for_spring_patch.ufo rename OTA_settings_for_spring_patch.ufo OTA_settings_for_spring_patch.ufo.old
IF EXIST Objects3D rename objects3d objects3dold
echo evOTAv2 Mod is set to "OFF" in your current default setting in TASpring.
pause
goto end  

:aaoff
if exist taenheter.hpi rename taenheter.hpi taenheter.ccx
if exist AbsoluteAnnihilation.ccx rename AbsoluteAnnihilation.ccx AbsoluteAnnihilation.old
echo Absolute Annihilation Mod is set to "OFF" your current default setting in TASpring.
pause
goto end  

:exit
echo The setting were not changed ... exiting ... now ...
pause

:end

:) ...
Last edited by genblood on 21 May 2005, 22:43, edited 1 time in total.
User avatar
Cheery
Posts: 129
Joined: 09 May 2005, 10:30

Post by Cheery »

LOL! This begun to run out of hands, but who cares? :P

Michilus, try find a way to make text-database for our mods. Lets see how long the batch file will stretch before we have to take C hammer to use.
Torrasque wrote:They are always a possibility that it could fail.
No, no there aren't a possibility for that. :roll:

For example, a = b + c never fails. never!
User avatar
Michilus_nimbus
Posts: 634
Joined: 19 Nov 2004, 20:38

Post by Michilus_nimbus »

Yep, you're right.
The current batch files work like a charm, no need to get it more complicated.
Torrasque
Posts: 1022
Joined: 05 Oct 2004, 23:55

Post by Torrasque »

Cheery wrote:LOL! This begun to run out of hands, but who cares? :P

Michilus, try find a way to make text-database for our mods. Lets see how long the batch file will stretch before we have to take C hammer to use.
Torrasque wrote:They are always a possibility that it could fail.
No, no there aren't a possibility for that. :roll:

For example, a = b + c never fails. never!
a= 4 b=2 c= 1 ...it's fail :) They is always someone to make things different ..
What are doing your script if you don't have the right to modify the file?
User avatar
Cheery
Posts: 129
Joined: 09 May 2005, 10:30

Post by Cheery »

no, c is a + b, there aren't different conditions.

I gues it's the user's problem if he doesn't have the rights to rename files.

Oh well, anyway, windows is stupid thing enough not to work well with any way of security.
And what comes into linux, the batch files doesn't work there.

You asked what it does, the rename command yells that, or then not... :wink:
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

I wonder of sombody will now actually take a programming language like Delphi into their hands, and make a program with at least this functionality. It's not that I don't like DOS interface, I do play ADOM after all, but something more or less releaseable is needed.
Post Reply

Return to “Engine”