Author
|
Topic: Semi on topic: Batch files
|
Syntaks WarLord
  
Posts: 231 From: Registered: Sep 2001 |
posted 27 December 2001 13:49
I was wanting to create a simple .bat file that would help with my Mod installation (in the even that I finish it some year)What I want to do: Rename the .mpq file to Backup.mpq, while renaming my Mod to the primary .mpq file Also want to create a backup Save folder, Renaming the regular folder "backup" Any help?

|
NefariusDX Honorary Warlord
   
Posts: 1392 From: The Hadal Abyss of Eternal Oblivion Registered: Jun 2001 |
posted 27 December 2001 14:02
answer dont use mpqs, second answer there are quintillions (thats a billion billions) of sites online that explain the basics of .bats and what you can do with them------------------ Nefarius' Secondary Mod Site Nefarius' Primary Mod Site ------------------ XyRAX v21.00 Comming Soon! ------------------ NëƒarIu§ ÖƒƒiçláL [V]oÞÞ¦hg §¡Nce D2C V1.02!!! quote: Gaze into the Oblivion within yourself and you shall become your greatest fears. the escence of leeching is to request before you try

|
Syntaks WarLord
  
Posts: 231 From: Registered: Sep 2001 |
posted 27 December 2001 14:42
I know ... And Quintillions of sites that didn't have what I was looking for  I swear I went to a dozen sites that didn't help me.. *sigh* ah well..

|
Myhrginoc Honorary Warlord
   
Posts: 1326 From: Percussion U Registered: Dec 2001 |
posted 27 December 2001 14:48
There are a few mod managers in the download area here (which I haven't looked into)...would one of them suffice? Otherwise, if you must roll your own, you need some safety checks built in or you might overwrite a character save file and wipe out your hard-earned gains.The MPQ files are the easiest, just have subdirectories in the Diablo II folder with the various DLLs and MPQs the mod comes with. Then have one subdirectory for the Blizzard original files, so you can go back to plain vanilla Diablo 2. Have your batch loader pull those files from the subdirectories, overwriting the current files. The character save directory is different. You have two files in each that matter, the rest are map saves. (Any subdirectories in the save directory are your realm characters, no D2S files there.) The D2S file has all your stats and skills, quest record, waypoints, and loot stored---if you back up no other file from the whole game ever, always back those up! The KEY file is where you store your command interface changes, such as the keys you assigned to hotkey skills. (I updated the default.key file in my mod MPQ to start a char off with all 16 skill hotkeys active, something Blizzard missed.) Don't believe Windows Explorer, that key file has nothing to do with the Registry. Back to D2S files...you would want your loader to save all the D2S files in your default save directory to whatever mod you played last, then bring forward any D2S files stored with whatever mod you are loading. It should also move the map files if you really care about them, but if you delete them instead you get new territory every game just like on realms (IMHO, that's a plus). Your loader should ask you before overwriting files, and maybe keep track of what mod you played last. Batch files are fine for automating much of this, but they can be quite stupid if you don't put in the safeguards.

|
NefariusDX Honorary Warlord
   
Posts: 1392 From: The Hadal Abyss of Eternal Oblivion Registered: Jun 2001 |
posted 27 December 2001 14:48
ill see if i can type down a batch tuto for renaming files here in a few------------------ Nefarius' Secondary Mod Site Nefarius' Primary Mod Site ------------------ XyRAX v21.00 Comming Soon! ------------------ NëƒarIu§ ÖƒƒiçláL [V]oÞÞ¦hg §¡Nce D2C V1.02!!! quote: Gaze into the Oblivion within yourself and you shall become your greatest fears. the escence of leeching is to request before you try

|
NefariusDX Honorary Warlord
   
Posts: 1392 From: The Hadal Abyss of Eternal Oblivion Registered: Jun 2001 |
posted 27 December 2001 14:53
instead of a tuto im gonna show you what to do to make a installer:type this in your batch file rename patch_d2.mpq BACKUP.mpq rename yourmpqfile.mpq patch_d2.mpq you can add @ECHO:OFF at the begin to make it do the install and dont display what it does, or ECHO:this will install my mod add pause to have a "press any key to continue" ------------------ Nefarius' Secondary Mod Site Nefarius' Primary Mod Site ------------------ XyRAX v21.00 Comming Soon! ------------------ NëƒarIu§ ÖƒƒiçláL [V]oÞÞ¦hg §¡Nce D2C V1.02!!! quote: Gaze into the Oblivion within yourself and you shall become your greatest fears. the escence of leeching is to request before you try

|
Syntaks WarLord
  
Posts: 231 From: Registered: Sep 2001 |
posted 27 December 2001 15:03
Thanks, Nefarius..Half the reason I'd like this is for the Save folder... I have 3 mods on my Drive, and having to manually switch between 3 save fiolders is annoying at best . . Would like a batch files that does the work for me  (yes .. I know .. lazy...)

|
NefariusDX Honorary Warlord
   
Posts: 1392 From: The Hadal Abyss of Eternal Oblivion Registered: Jun 2001 |
posted 27 December 2001 15:33
use -direct -txt, lol u wont need to switch any thing and can have as many mods installed at the same time as you like, just a matter of clicking right short cut------------------ Nefarius' Secondary Mod Site Nefarius' Primary Mod Site ------------------ XyRAX v21.00 Comming Soon! ------------------ NëƒarIu§ ÖƒƒiçláL [V]oÞÞ¦hg §¡Nce D2C V1.02!!! quote: Gaze into the Oblivion within yourself and you shall become your greatest fears. the escence of leeching is to request before you try

|
Syntaks WarLord
  
Posts: 231 From: Registered: Sep 2001 |
posted 27 December 2001 15:48
Yeah, but they all pull from the same save folder.. My SO was playing her Barbarian and accidentally started up my Mod ... Totally screwed up her character. So now, i have multiple save floders.

|
FoxBat Moderator
   
Posts: 1618 From: PA, USA Registered: Feb 2001 |
posted 27 December 2001 18:32
I use Visual Basic Scripting to swap dlls, run -direct -txt, AND mainatin seperate save folders. It's much safer this way because it modified a registry key pointing to the different save folders rather than copying them around.Just copy and paste this into a new text document, then rename it as "runmod.vbs" 'Create a shell object Set Shell = WScript.CreateObject("WScript.Shell") 'Get path to Diablo II EXE from registry D2Path = Shell.RegRead("HKCU\Software\Blizzard Entertainment\Diablo II\InstallPath")& "\" 'Create a file system object Set FSO = WScript.CreateObject("Scripting.FileSystemObject") 'Get the current directory folder object Set Folder = FSO.GetFolder(".") 'Get full pathname of current directory and append save dir name Dir = Folder.Path & "\Save\" 'Get file object for D2Client.dll in Diablo directory Set ClientDLL = FSO.GetFile(D2Path & "D2Client.dll") Set GameDLL = FSO.GetFile(D2Path & "D2Game.dll") Set CommonDLL = FSO.GetFile(D2Path & "D2Common.dll") 'If Diablo path is not the current directory run MOD otherwise just fix up If Folder.Path & "\" <> D2Path Then 'Check if a D2Client.dll exists in the current directory If FSO.FileExists(Folder.Path & "\D2Client.dll") Then 'Rename DLL in Diablo directory ClientDLL.Move (D2Path & "D2Client.bak") End If 'Check if a D2Game.dll exists in the current directory If FSO.FileExists(Folder.Path & "\D2Game.dll") Then 'Rename DLL in Diablo directory GameDLL.Move (D2Path & "D2Game.bak") End If 'Check if a D2Common.dll exists in the current directory If FSO.FileExists(Folder.Path & "\D2Common.dll") Then 'Rename DLL in Diablo directory CommonDLL.Move (D2Path & "D2Common.bak") End If 'Get current save folder SaveDir = Shell.RegRead("HKCU\Software\Blizzard Entertainment\Diablo II\Save Path") 'Write our new save directory in the registry Shell.RegWrite "HKCU\Software\Blizzard Entertainment\Diablo II\Save Path", Dir, "REG_SZ" 'Ensure script gets to clean up if launching Diablo II fails on error resume next 'Launch Diablo II with -direct option and wait for it to finish Result = Shell.Run(chr(34) & D2Path & "Game.exe" & chr(34) & " -direct -txt", 1, TRUE) End If If ClientDLL.Name = "D2Client.bak" Then ClientDLL.Move (D2Path & "D2Client.dll") End If If GameDLL.Name = "D2Game.bak" Then GameDLL.Move (D2Path & "D2Game.dll") End If If CommonDLL.Name = "D2Common.bak" Then CommonDLL.Move (D2Path & "D2Common.dll") End If 'Restore previous save directory setting in registry Shell.RegWrite "HKCU\Software\Blizzard Entertainment\Diablo II\Save Path", SaveDir, "REG_SZ"

|
Myhrginoc Honorary Warlord
   
Posts: 1326 From: Percussion U Registered: Dec 2001 |
posted 28 December 2001 00:40
Thanks, FoxBat...that is just the sort of safety checking I was thinking of. I haven't explored VBS writing yet, all my experience with batch files is in plain old DOS. You don't mention it, but do I put a copy of the script file in each subdirectory dedicated to an individual mod?If a machine is running a mod with this script running in the background, and the machine crashes good and hard...the mod save directory will be left in the Windows Registry. Re-running the mod loader script will merely store two copies of the mod save directory in its variables. I would suggest putting copies of the Blizzard original DLLs and MPQ in a dedicated subdirectory (just like a mod), with a "restore default" script consisting of the back half of FoxBat's script: get Diablo2 working directory from Registry; copy files from Blizzard backup directory; define default save directory as ...\Diablo II\save; write default save directory to Registry key. I am going to set these scripts up on my machine now---been doing these swaps manually before... 

|
Syntaks WarLord
  
Posts: 231 From: Registered: Sep 2001 |
posted 28 December 2001 09:40
 I think I'll stick with manual swapping . Waaaaay too many possibilities for me to screw up my computer 

|