Search the database
Search forum topics
Search members
Search for trades
diablo2.io is supported by ads
diablo2.io is supported by ads
4 replies   1809 views
2

Description

Hey guys, just here for some nerdy stuff.

Since I had some hard time when I died and lost exp (and gold but that's just not important) I started to back up my saved game files to another location before every rush to a unique boss or so. I was manually doing it but it really started to annoy me so I made an excel file to do it for me. Just open a blank Excel file, Alt+F11 to enter VBA. Insert → Module and paste the following code. Don't forget to change the folder paths to your own favor:

Code: Select all

Sub Game2Backup()
    Dim fso As Object
    Dim sourceFolder As String, mainDestinationFolder As String, backupDestinationFolder As String
    Dim fileName As String
    
    ' Specify your source, main destination, and backup destination folders
    sourceFolder = "C:\Users\Administrator\Saved Games\Diablo II Resurrected\" ' Update this with your source folder path
    mainDestinationFolder = "C:\Users\Administrator\Desktop\Saved\zzz\" ' Update this with your main backup folder path
    backupDestinationFolder = "C:\Users\Administrator\Desktop\Saved\www\" ' Update this with your second backup destination folder path
    
    ' Create a FileSystemObject
    Set fso = CreateObject("Scripting.FileSystemObject")
    
    ' Loop through files in the source folder
    For Each file In fso.GetFolder(sourceFolder).Files
        fileName = file.Name
        
        ' Copy the file to the backup destination folder
        fso.CopyFile sourceFolder & fileName, backupDestinationFolder & fileName
    Next file
    
    ' Loop through files in the source folder again to copy them to the main destination folder
    For Each file In fso.GetFolder(sourceFolder).Files
        fileName = file.Name
        
        ' Copy the file to the main destination folder
        fso.CopyFile sourceFolder & fileName, mainDestinationFolder & fileName
    Next file
    
    ' Clean up
    Set fso = Nothing
End Sub

After that close VBA editor and create 2 shapes or buttons, assign the macro named Game2Backup to one of them. Start the process over but now change the title to Backup2Game and then again change the folders as intended. You can now delete line starting with backupDestinationFolder alltogather since it's only there for manually changing the content. Assign the new macro to the second shape. Mine looks like this:
Now I run the Excel file in the background, then start the game. After every successful rush, I sell or keep items etc, I rearrange potions, do the repairs and I save&exit the game. Then by simple pressing Alt+Tab, I bring the Excel file on top and click on my green button. Then I re-enter the game.

Don't know if anyone ever needed such a file exchange shortcut but it is here anyway. Cheers.

p.s. You can also use it before trying out a runeword. I had to repeat the process about 5-6 times before I finally reached a nice enhanced dmg % (to be specific, 334%) with my Oath.
Description by karaage
5

Can be used to make Runewords:

7
Hey guys, just here for some nerdy stuff.

Since I had some hard time when I died and lost exp (and gold but that's just not important) I started to back up my saved game files to another location before every rush to a unique boss or so. I was manually doing it but it really started to annoy me so I made an excel file to do it for me. Just open a blank Excel file, Alt+F11 to enter VBA. Insert → Module and paste the following code. Don't forget to change the folder paths to your own favor:

Code: Select all

Sub Game2Backup()
    Dim fso As Object
    Dim sourceFolder As String, mainDestinationFolder As String, backupDestinationFolder As String
    Dim fileName As String
    
    ' Specify your source, main destination, and backup destination folders
    sourceFolder = "C:\Users\Administrator\Saved Games\Diablo II Resurrected\" ' Update this with your source folder path
    mainDestinationFolder = "C:\Users\Administrator\Desktop\Saved\zzz\" ' Update this with your main backup folder path
    backupDestinationFolder = "C:\Users\Administrator\Desktop\Saved\www\" ' Update this with your second backup destination folder path
    
    ' Create a FileSystemObject
    Set fso = CreateObject("Scripting.FileSystemObject")
    
    ' Loop through files in the source folder
    For Each file In fso.GetFolder(sourceFolder).Files
        fileName = file.Name
        
        ' Copy the file to the backup destination folder
        fso.CopyFile sourceFolder & fileName, backupDestinationFolder & fileName
    Next file
    
    ' Loop through files in the source folder again to copy them to the main destination folder
    For Each file In fso.GetFolder(sourceFolder).Files
        fileName = file.Name
        
        ' Copy the file to the main destination folder
        fso.CopyFile sourceFolder & fileName, mainDestinationFolder & fileName
    Next file
    
    ' Clean up
    Set fso = Nothing
End Sub

After that close VBA editor and create 2 shapes or buttons, assign the macro named Game2Backup to one of them. Start the process over but now change the title to Backup2Game and then again change the folders as intended. You can now delete line starting with backupDestinationFolder alltogather since it's only there for manually changing the content. Assign the new macro to the second shape. Mine looks like this:
Now I run the Excel file in the background, then start the game. After every successful rush, I sell or keep items etc, I rearrange potions, do the repairs and I save&exit the game. Then by simple pressing Alt+Tab, I bring the Excel file on top and click on my green button. Then I re-enter the game.

Don't know if anyone ever needed such a file exchange shortcut but it is here anyway. Cheers.

p.s. You can also use it before trying out a runeword. I had to repeat the process about 5-6 times before I finally reached a nice enhanced dmg % (to be specific, 334%) with my Oath.
7
User avatar

Schnorki 3199Moderator

PC
Much as I applaud the effort, running Excel in the background for that sort of thing seems like a bit of a wasted extra step/resource drain (albeit not a massive one).

A simple 1-liner xcopy batch (or 2, one to backup, one to restore) would do the same thing and could simply be run as needed.
7
If you plan to cheat (in case of RW rerolling, it's the equivalent of duping the whole rune set +
Hel
, and in case of resurrecting a HC character...), why don't you just use the Hero Editor?

I agree with Schnorki about making a one-liner. I'd make one in Python or maybe in Powershell (and make the paths params instead of being hardcoded). Probably VBA can be used in the same way.
7
Been a long time since I looked @ VB code (started programming with VB6 back in early 2000s). The xcopy one liner is def the way to go from an efficiency standpoint. But still pretty nifty to see other (non-meta) ways to accomplish this. Thanks for sharing!

When I'm not slaying demons, I'm usually out hiking mountains.
7
You can also use git and commit your save folder regularly, before messing with rune words or stuff like that.
Then you can easily restore any previous save point where you know you had that facet you want back from its socket now ^^
9

Advertisment

Hide ads
999

Greetings stranger!

You don't appear to be logged in...

99

Who is online

Users browsing Forums: DotNetDotCom.org [Bot], Dromar186, krathkor and 73 guests.

No matches
diablo2.io is supported by ads
 

 

 

 

Value:
Hide ads forever by supporting the site with a donation.

Greetings adblocker...

Warriv asks that you consider disabling your adblocker when using diablo2.io

Ad revenue helps keep the servers going and supports me, the site's creator :)

A one-time donation hides all ads, forever:
Make a donation