-
-
Save aqt/8432b26a7a526e4d61ed13066b129567 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node | |
/* | |
If you run the script on an encoded file it will output a decoded file and | |
vise versa, because the action used to encode/decode is identical. The save | |
file format when decoded is plaintext JSON, which you can edit with your | |
favorite text editor. | |
You can find the save file at the following path. Please make a backup of the | |
file before you make any adjustments to it! | |
%userprofile%\AppData\LocalLow\Sabotage Studio\The Messenger\saveGame.txt | |
*/ | |
const fs = require("fs"); | |
if (process.argv.length < 4) { | |
console.log("Required arguments: <inFile> <outFile>"); | |
process.exit(1); | |
} | |
const inFile = process.argv[2]; | |
const outFile = process.argv[3]; | |
function convertFile(inFile, outFile) { | |
const data = fs.readFileSync(inFile, "utf-8").split("\r\n")[0]; | |
let convertedData = ""; | |
for (const char of data) { | |
const charCode = char.charCodeAt(0); | |
const isOdd = charCode % 2; | |
const nudge = isOdd ? -1 : 1; | |
const newCharCode = (charCode ^ 128) + nudge; | |
convertedData += String.fromCharCode(newCharCode); | |
} | |
fs.writeFileSync(outFile, convertedData + "\r\n"); | |
} | |
convertFile(inFile, outFile); |
Hello,
first of all thanks for the creation of that code.
I am new to javascript and I wanted to ask how I run this script. I added the paths, but it always give me an error message about the const.
Maybe I have written everything wrong or i just dont now how to use that kind of script.
I really hope you can help me with that problem.
sincerely Ben
Hi @benxzmn, I will try to be detailed in guiding you as I don't know how much technical knowledge you have.
I recommend downloading this script by right-clicking the "Raw" button in the top right of this page, and choosing "Save Link As...". This way you can be sure you did not miss any letters when copying it. To make the steps easy I also suggest moving the file to the same directory as the game save files, otherwise you need to use the full file paths (instead of just the file names) when running the script.
The script should be run with Node which you will need to download and install.
- Open a command prompt (cmd or PowerShell). Not before installing node, as the
node
command will then not be recognized- Open the start menu and search for cmd, it should show the application Command Prompt
- or, press the keyboard keys Windows (flag) and x together then choose the command prompt in the list
- Change directory in the command prompt to where you saved the file (in this case the save file directory)
- Write
cd "%userprofile%\AppData\LocalLow\Sabotage Studio\The Messenger"
and run the command by pressing the Enter keyboard key
- Write
- Write the following, make sure to add a space character after each:
node
- File path/name to the script (
the_messenger_save_decoder.js
) - Path/name of the encoded save file (
saveGame.txt
) - Path/name of the decoded save file (
saveGameDecoded.txt
, can also besaveGame.txt
to overwrite the file but just to be sure I would recommend against it)
- If you are using cmd you can also drag-and-drop the file onto the window and it will automatically type the path for you
- Run the command which should now look like this:
node the_messenger_save_decoder.js saveGame.txt saveGameDecoded.txt
. The script reads the first file, and overwrites the second file. If you see any error message when running this command please share it - Open the decoded file
saveGameDecoded.txt
in a text editor (such as notepad, vs code. Do not use Word or similiar word processors as they may change the file unpredictably), and make your adjustments- Note that this file contains save data for all three save slots, if you are using multiple slots make sure you edit the correct one
- Run the command again, but this time switch the order of the encoded/decoded save file names:
node the_messenger_save_decoder.js saveGameDecoded.txt saveGame.txt
- Restart the game and enjoy your modified save file
I have not explored the format beyond decoding it, for example what items have what IDs, so unfortunately I can not advise you on what to change to get certain results. I have only made the adjustment mentioned in the previous comment, which I inferred from the naming of the data.
Hope this will be of use to you!
Hey @aqt thanks a lot for this tutorial. It helped a lot. Ive gotten it to work and I achieved the Achievement.
I wish you the best.
My purpose for creating this script was so I could unlock the achievement "I Swear It's My First Time", which I missed in my playthrough. If you too want a chance at unlocking it without trekking through the whole game again you can follow these directions:
true
. This is what unlocks the time rifts, which are required both to enter AND beat the cave area.false
. It was only used to quickly start with the necessary key items, it's safe to turn off afterwards. Having to pay your greed demon each time you die will get old quick.It should only take around 10-15 minutes to progress to the cave area, but if you are feeling extra lazy you can set the value of "checkpointSaveInfo" to the following in order to spawn inside the cave:
{"mana":5,"loadedLevelDimension":2,"playerLocationDimension":2,"loadedLevelName":"Level_04_B_DarkCave_Build","playerLocationSceneName":"Level_04_B_DarkCave_Build","loadedLevelPlayerPosition":{"x":-4.0,"y":-3.5,"z":0.0},"loadedLevelCheckpointIndex":-1,"playerFacingDirection":1.0}