Error with a script to separate Undertale proggress

Joined
Dec 19, 2024
Messages
1
Reaction score
0
Hi everyone! Some time ago, I installed a mod to play Undertale with friends called "Undertale together". Since the mod was installed directly on Undertale´s folder, I wanted to make a copy and keep both my individual progress and the progress I made with my friends. Investigating, I found that the game saves all the proggress in a folder called "UNDERTALE", which can be found in the local appdata of the computer. If I have two copies of this folder, I can keep different saving points by changing the name of these. (For example, for the mod I´d call the folder "UNDERTALE_TOGETHER" and for the original one "UNDERTALE_ORIGINAL". If I was about to play the normal undertale, I´d change the name of the folder "UNDERTALE_ORIGINAL" to just "UNDERTALE", this way making the game save all the data in this folder. The same with Undertale together, but using its own folder instead of the original one.

Well, basically, that´s what I tried to do with my script to automatize the process and rename the folders in function to the last folder used and the one I´m about to use. Since Undertale together has a version of two players and other of 3-4 players, I´d need 3 folders, and I´d need to change between folder names to make sure I´m getting the correct save file.

If I choose the third option, it works nicely. The problem is when I try to change from the Undertale of 3-4 players to any other version. The code practically "jumps" the ifs and it doesn´t change the folder names at all. I tried using other script with just two options, and no matter which version of Undertale, they worked perfectly. Can you help me? (At this point, I´m pretty sure it´ll be just a syntax error, but I´m kind of desperate to solve the problem. Anyway, thanks for the help!) AAAAAND by the way, it´s a bat file. The code is the following:
@echo off
set original_save=C:\Users\carlo\AppData\Local\UNDERTALE_ORIGINAL
set together_save=C:\Users\carlo\AppData\Local\UNDERTALE-T
set togetherm_save=C:\Users\carlo\AppData\Local\UNDERTALE-TM
set current_save=C:\Users\carlo\AppData\Local\UNDERTALE
echo Selecciona la version:
echo 1. Original
echo 2. Together
echo 3. TogetherM
set /p version="Selecciona (1/3): "
if "%version%"=="1" (
if exist %original_save% (
if exist %togetherm_save% (
rename %current_save% UNDERTALE-T
rename %original_save% UNDERTALE
echo Archivos configurados correctamente! Cambiado de Together 2 Jugadores a Original )
) else if exist %original_save% (
if exist %together_save% (
rename %current_save% UNDERTALE-TM
rename %original_save% UNDERTALE
echo Archivos configurados correctamente! Cambiado de Together 34 Jugadores a Original )
) else if exist %together_save% (
if exist %togetherm_save% (
echo El archivo ya estaba configurado! )
) else echo Alguno de los archivos no existe
) else if "%version%"=="2" (
if exist %together_save% (
if exist %togetherm_save% (
rename %current_save% UNDERTALE_ORIGINAL
rename %together_save% UNDERTALE
echo Archivos configurados correctamente! Cambiado de Original a Together 2 Jugadores )
) else if exist %together_save% (
if exist %original_save% (
rename %current_save% UNDERTALE-TM
rename %together_save% UNDERTALE
echo Archivos configurados correctamente! Cambiado de Together 3 o 4 Jugadores a Together 2 Jugadores )
) else if exist %original_save% (
if exist %togetherm_save% (
echo El archivo ya estaba configurado!)
) else echo Alguno de los archivos no existe
) else if "%version%"=="3" (
if exist %togetherm_save% (
if exist %together_save% (
rename %current_save% UNDERTALE_ORIGINAL
rename %togetherm_save% UNDERTALE
echo Archivos configurados correctamente! Cambiado de Original a Together 3 o 4 Jugadores )
) else if exist %togetherm_save% (
if exist %original_save% (
rename %current_save% UNDERTALE-T
rename %togetherm_save% UNDERTALE
echo Archivos configurados correctamente! Cambiado de Together 2 Jugadores a Together 3 o 4 Jugadores )
) else if exist %original_save% (
if exist %together_save% (
echo El archivo ya estaba configurado!)
) else echo Alguno de los archivos no existe
) else (
echo No existe esa opcion, bobin. Elije del 1 al 3
)
pause

Here is a image of what happens if I try to change from 3/4 players to the version of 2 players (It´s the same if I try changing to the Original ver.) and yes, I checked if the folders changed. They didn´t.
imagen_2024-12-18_201111830.png


And here a cap of what is supposed to happen (The example is changing from the Original Undertale to the One of two players)
1734574449073.png
 
Joined
Sep 21, 2022
Messages
200
Reaction score
27
Instead of one complicated batch file, you could have 6 one-line batch files. Each file has one rename statement in it.

on1.bat, off1.bat
on2.bat, off2.bat
on3.bat, off3.bat

run on1, play the game, run off1

run on2, play the game, run off2

and so on, no chance of bugs this way.
 
Joined
Jul 4, 2023
Messages
545
Reaction score
71
In addition to CMD, you can use PowerShell (PS), VBScript (VBS), and VBScript with HTA (HTML Application) for folder manipulation. HTA (HTML, CSS i JavaScript) allows you to create simple GUI-based applications that integrate with Windows, enabling VBScript execution. These tools are part of the system, so no installation is required.

IMO, writing code in any of the languages mentioned above will be easier and more readable compared to CMD, providing better clarity and structure for more complex tasks.
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,109
Messages
2,570,670
Members
47,260
Latest member
MadelaineK

Latest Threads

Top