Help me with a Backup Character script

ITS'aME'aMARIO!!!!

New Adventurer
Joined
Jul 28, 2004
Messages
725
Reaction score
0
Location
Daragoth
It gets annoying having to leave the game to backup my character. I've heard of people making scripts to backup and load characters ingame.
Can someone help me make one? You can either show me how or just give me a download(or just not help me at all! :oldlol: )

please help me out :)
 

Blaze

New Adventurer
Joined
May 25, 2005
Messages
86
Reaction score
0
Location
Canada
or if there is a cmd for copying a file to a destination... that would be fine :D
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Contrary to popular belief, the Half-Life scripting language is very, very limited. There's no console command to copy a file.

Your options are:
- make a batch file that backs up your character every time you play
- make a batch file that backs up every so often
- make a windows VBA script that can be called by a windows shortcut key

I used to have a little VBA app that managed a whole slew of characters and backed up the main on every so often, or when a shortcut key was called, but that was back in the days of Won, and I've not bothered to make another one since. (Instead I have 5000 'copy of save1.char ')
_________________
"If you love something, cut it into tiny little peices and throw it in the river... If it comes back, it's most likely a vampire or something, so you should probably keep stabbing it with a stake." - Hyper Death Babies
Saint Thoth
 

ITS'aME'aMARIO!!!!

New Adventurer
Joined
Jul 28, 2004
Messages
725
Reaction score
0
Location
Daragoth
great, now seeing that im a complete newbie at this. Can you tell me what a batch file is? I think thats what i heard when these two guys were talking about automatically backing up characters. What is a VBA script?
 

stevenlafl

New Adventurer
Christian Warrior's of God
Joined
Dec 31, 2004
Messages
34
Reaction score
0
Location
Florida, USA
a batch file is a ....batch of commands that tell DOS what to do. I cna write inside it..
as for instance a bakcup script:
Code:
copy "C:\program files\steam\steamapps\MYEMAIL\half-life\ms\save1.char" "C:\program files steam\steamapps\MYEMAIL\half-life\ms\backups"

then I can simply use another script to put my backup in place..
Code:
copy "C:\program files\steam\steamapps\MYEMAIL\half-life\ms\backups\save1.char" "C:\program files steam\steamapps\MYEMAIL\half-life\ms"
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
VBA/S = Visual Basic (for) Applications/Script. One of many little scripting languages built into windows for hackers to exploit your computer with. ;)

Anyways, batch file being easier to make and all:

Right click on your desktop, click New-->Text Document. Open it, and add the following text:

Code:
@echo off
copy "C:\program files\steam\steamapps\MYEMAIL\half-life\ms\save1.char" "C:\program files\steam\steamapps\MYEMAIL\half-life\ms\%random%.char"

(Note that "MYEMAIL" must match your Steam account, and the path "C:\program files\steam\steamapps\MYEMAIL\half-life\ms\" must match your Steam path to your MS folder. The rest of the 'code' should be typed as-is and, from "copy" on, should all be on one line (there should only be two lines in the document total).

Now that you have that txt file, rename (F2) it to "ms_backup.bat" (ignore window's bitching about the extension change.)

Right click on the desktop icon for "ms_backup.bat", and click Properties. On the resulting window, click on "Shortcut Key:", and assign the vulcan death-grip shortcut key of your choosing (such as Ctrl+Shift+Alt+B). You may also change the "Run:" drop down dialogue to "minimized" to help prevent the batch file from interfering with MS.

Alright, whenever you press Ctrl+Shift+Alt+B in game, this little batch file should run. It will make a backup of Save1.char in your MS folder. The new file shall be assigned a random number between 0 and 32768 with the extension of .char (it may float around 16k though). To find the latest backup of your character, simply open your MS folder, and sort the files by Date by clicking on the "Date Modified" list header twice.

To restore said character, exit MS, delete your current save1.char, and rename the latest randomnumber.char file to save1.char.

This will work with Win2k and WinXP (and maybe NT) - I can't guarantee it will work in Windows 98 (as I can't remember if 98 had the %random% function).
_________________
"We must remain as close to the flowers, the grass, and the butterflies as the child is who is not yet so much taller than they are." - Friedrich Nietzsche
Saint Thoth
 

J-M v2.5.5

BANNED
BANNED
Joined
Feb 26, 2005
Messages
5,675
Reaction score
1
Age
35
Location
Nijmegen, the Netherlands.
Thothie said:
Right click on the desktop icon, and click Properties, then click on "Shortcut Key:", and assign the vulcan death-grip shortcut key of your choosing (such as Ctrl+Shift+Alt+B). You may also change the "Run:" drop down dialogue to "minimized" to help prevent the batch file from interfering with MS.
Desktop icon where? The one I see in my quickstart toolbar or the one I see in Explorer? Because I tried both and see nothing like "Shortcut Key". I might be looking at the wrong place...?
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
The desktop icon for the document you created, which should be named "ms_backup" by the time you get to that step.
_________________
"Old laser physicists never die, they just become incoherent."
Saint Thoth
 

Blaze

New Adventurer
Joined
May 25, 2005
Messages
86
Reaction score
0
Location
Canada
i can't find "Shortcut key" that you sayed... i was not able to change the extention because i had extentions on "HIDE" well known extensions like that.... i fix that part but not the "shortcut key... ill try looking for it
 

Blaze

New Adventurer
Joined
May 25, 2005
Messages
86
Reaction score
0
Location
Canada
XD you got me partner.... its getting DARK! ahhh... tell my family.. i love them, please! X-| *DEAD*

P.S anyone actually USEING my file?
 

J-M v2.5.5

BANNED
BANNED
Joined
Feb 26, 2005
Messages
5,675
Reaction score
1
Age
35
Location
Nijmegen, the Netherlands.
ceriux said:
he really banned o_O?
Nah, this is just Kuroneko's style of humor. :wink:

I was in-game with him and a few others on my server in Helena once, and I was slashing orcs when Kuroneko got in my slashing range so before I really noticed it I killed him in one hit and he was like "BAN!"... :mrgreen:
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
P.S anyone actually USEING my file?

I took at look at it just to see what you did, and I see you have shortcuts for both backup and restore... I should point out that you can't normally restore a character in game, as the character file is 'in use' by the game and thus write protected.

Other things I should point out, is that not everyone has their MS folder in the same location as yours (indeed, most have it elsewhere), so your batch file wont work for most (you should mention this in your Readme). In addition, your shortcuts were created on your desktop, and thus direct to a file in your windows user directory, and will work for no one else but you. ;)

Now that I've had a little more time, here's a batch file that will solve most issues:

Code:
@echo off
set msext=\ms\
set stamp=%date:/=-%,%time::=.%
FOR /F "tokens=2*" %%A IN ('REG QUERY "HKCU\software\valve\steam" /v ModInstallPath') DO SET steamdir=%%B
set msfolder=%steamdir%%msext%
echo MS folder is: %msfolder%
echo Backup file name will be: %stamp%.char
copy "%msfolder%save1.char" "%msfolder%%stamp%.char"

That code can be copied to a batch file, it will find your MS folder on its own, no matter where you may have put it, or what your user name is, by checking the registry entry for Steam. This code should not be modified in any way.

The backup file name, rather than a random number, is based on the current date and time (down to 10th/sec). So your backup file would look like nyah:
Mon 08-01-2005,19.13.19.82.char
(Those of you using European date formats will be a lil different, but should still work)

This batch file will only work in XP/2k with Steam, as Win98 does not offer string parsing in batch files. (Actually had to look up how to do that, I'd forgotten or I woulda done it in the first batch file). ;)
_________________
"You are a child of the universe, no less than the trees and the stars; you have a right to be here. And whether or not it is clear to you, no doubt the universe is unfolding as it should." -Max Ehrmann
Saint Thoth
 

Bobster1234

New Adventurer
Joined
Jul 21, 2004
Messages
20
Reaction score
0
I thought thothie's little automatic "find the area" script was so cool I included it in mine. :D Really, there isn't much of a different between Thothies and mine just that mine is a little more organized. It copies the charater into a folder named backup in your Master Sword file and creates some more folders depending on the date. So when you run it will be placed under an area based off of the date.

Today is 8/3/2005, so you'll find your backups in MS/backup/2005/8/3/ and boom there is your charater files. Also it plays a cool little sound file so you know that it ran, but the downside so it can runs a little error on you when you don't put the sound file in the same directory as the exe file, but I've coverd how to fix it in the "read meh.txt" which is included with the zip but of course if you don't want that sound playing there is the soundless version included also.


Download from here:

Click me to download
 

Blaze

New Adventurer
Joined
May 25, 2005
Messages
86
Reaction score
0
Location
Canada
actually i think it is possable to restore while INGAME i believe MS does not have the file in use ALL the time just when loading or when saveing which is sippose to be every 10 seconds or when an action is done... ill test this out and get the answer...
 

Bobster1234

New Adventurer
Joined
Jul 21, 2004
Messages
20
Reaction score
0
The only way I could see that idea actually working is using an other charater then restoring the one that just broke, then having to switch back. I'm also thinking you could just leave the server and just load them up at the MS welcome screen, but loading dynaimcally... I'm kind of spectical about that one...
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Master Sword "opens" savex.char file you are using when you load it, and doesn't close it (release the handle) again until you chose another character or close Master Sword. So no, you can't restore your active character. But like Bob said, it maybe possible to restore the character to another slot and use that character.

Win98's file sharing behavior works a lil differently, and I think you can tweak XP/2k to change its file sharing behavior in such a way that you may be able to overwrite a file with an open handle. This can cause issues with the DLL cache though, or so I've read.
_________________
"It's deja vu all over again." - Yogi Berra
Saint Thoth
 
Top