Page 1 of 1
Recovering Lost .hs File
Posted: Tue Apr 05, 2011 3:37 pm
by Meatballsub
I'm considering doing some more work on a game of mine, but it wouldn't be possible unless I could somehow recover the script file from it. The original script file is long gone and I was curious if there was a way to extract it from the RPG file or something like that.
Any help is appreciated.
Posted: Tue Apr 05, 2011 4:18 pm
by Bob the Hamster
Yes, but it depends on how old it is. If it is old, you cannot recover the script.
If the script was last compiled with any version of hspeak.exe after 2009-07-27 then it automatically includes a backup copy.
Use unlump.exe to extract your RPG file into a folder. Then look inside and find your .hsp file inside (usually this is ohrrpgce.hsp but it might also be gamename.hsp)
inside the unlumped hsp folder, look for either source.txt or source.lumped.
source.txt exists in scripts compiled between 2009-07-27 and 2010-04-11 and it is a somewhat mangled but still easily repairable copy of your script (it also has a copy of plotscr.hsd embedded into it, and you need to manually trim it out)
source.lumped exists in scripts compiled between 2010-04-11 to the present. it is a lump file which you can extract with unlump, and it contains a clean copy of your script and all include files.
EDIT: Writing all that out makes me think we need a little "Backup Extractor" tool that does all of that automatically for you :)
Posted: Tue Apr 05, 2011 4:41 pm
by Meatballsub
Well crap, guess I'm out of luck then. Last time I compiled the script was back in '07. Thanks for the help anyways.
Posted: Tue Apr 05, 2011 5:20 pm
by Bob the Hamster
Meatballsub wrote:Well crap, guess I'm out of luck then. Last time I compiled the script was back in '07. Thanks for the help anyways.
Sorry to hear it.
Which game was this, out of curiosity?
Posted: Tue Apr 05, 2011 5:52 pm
by Meatballsub
Posted: Tue Apr 05, 2011 10:02 pm
by Pepsi Ranger
Just out of curiosity, if we have a button to import scripts, and we have a button to export hsi data, why don't we have a button to export scripts? They're clearly stored in the game, otherwise they would never run, right? I mean, we have the ability to export textbox data. What's stopping this from becoming feasible?
EDIT: Or why not create a command line in GAME.EXE that dumps plotscript commands into a debug file as they're run when a script activates, if CUSTOM can't make sense of it?
Posted: Tue Apr 05, 2011 10:35 pm
by Bob the Hamster
Pepsi Ranger wrote:Just out of curiosity, if we have a button to import scripts, and we have a button to export hsi data, why don't we have a button to export scripts? They're clearly stored in the game, otherwise they would never run, right? I mean, we have the ability to export textbox data. What's stopping this from becoming feasible?
EDIT: Or why not create a command line in GAME.EXE that dumps plotscript commands into a debug file as they're run when a script activates, if CUSTOM can't make sense of it?
Well, until 2009-07-27 there was only compiled script data in the RPG file. Getting source code out of a compiled binary is a little like getting a cow out of a hamburger.
But yes, a menu option to export the saved script is feasible, it would just only work for newer games.