Mod Installers

Do you know how to pass an arguement to a batch file?

  • Yes

    Votes: 0 0.0%
  • No

    Votes: 0 0.0%
  • WTF?

    Votes: 0 0.0%

  • Total voters
    0
  • Poll closed .

Users who are viewing this thread

compfreak

Recruit
I'm writing programs for easy installation of some of the mods. So far I've done:
Magnificent 7+Hugemod
Hugemod

Next I'll do:
LotR or something.

Here are the links:

Magnificent 7 installer. Just download, then double-click the file for it to extract itself and double-click install.bat . You don't even need to download Mag7 or Hugemod. They are part of the file, and this will install Hugemod before Mag7.
The Mag7 installer in a zip file. This one is only the installer. Extract the files to the directory where you have hugemod.zip and Mag7_v[1].14.zip . Then double-click Install.bat .
Hugemod Installer. Just download, then double-click the file for it to extract itself and double-click install.bat . You don't even need to download Hugemod. It is part of the file.
The Hugemod Installer in a zip file. This one is only the installer. Extract the files to the directory where you have hugemod.zip . Then double-click Install.bat .

Have fun!


About the poll: see my second post.
 
Woo Hoo ! Now N00bs like me dont get confused :lol: Ill still probably manage to break M&B sumhow with it, lol Yay ! first downloader :P Probably cause im the last person to get those 2 mods :lol:
 
So did it work? I checked them on my computer but I don't know if other versions of windows will interpret it properly. They should, but I need to make sure.
 
well you should put in a option of where to override, i accidently installed it on my C drive M&B which is the none modded version (now modded) my E drive version is the modded one, now its all messed up lol... ah well, hope it works.
 
Goodjob on the installer's.
Although i tend to find .exe's a pain in the ass sometime's. Since either way with a zip or exe you have to point it to your M&B directory.
But still great for people who are hopeless with zip file's.
 
scottyg_20 said:
well you should put in a option of where to override, i accidently installed it on my C drive M&B which is the none modded version (now modded) my E drive version is the modded one, now its all messed up lol... ah well, hope it works.
I thought about this, but I didn't expect anyone who doesn't click 'next, next, give me spyware, next' to need help installing. I'll write %programfiles% instead of 'C:Program Files', but anything more would be too much effort to help people who can do it themselves.

Edit: I found the right variable. And now that I think about it, you ignored my warning about backing up files first. :P
Anyways, I think I figured out a way to make this easy for technophobes while still allowing those with special set-ups to use this. To determine whether I should though, I have a question for everyone. Do any of you know how to pass arguements to a batch file? If enough people know, I'll make the script have an optional %gamedir% arguement.
 
Sure. I'll put the source code for one below and comment on what each part does. The souce is vey short since I used batch files.
This is the code for the Mag7 installer. It is by far the most complex, so it makes the best example.

Install.bat
Code:
@echo off
rem 'Rem' is the comment command.
rem Use it for markup when writing batch files.
rem '@echo off' is the standard beginning for batch files. It prevents each line from being typed, which looks ugly.
prompt Mag7 Install$G 
rem 'Prompt' changes the words at the beginning of the line.
rem The '$g' is a special charecter that displays a bracket '>'.
rem This is necessary because a '>' would transfer the output of the prompt command to another device. That's a little more advanced than is necessary for this.
echo If you want to install the Magnificent 7 mod, press space.
rem 'Echo' displays text and can be used for some cool tricks which don't matter here.
echo.
rem 'Echo.' just creates a blank line.
echo If you do not want to install it, press ctrl-c and type "y" now.
echo.
echo.
pause
rem 'Pause' pauses processing until the user presses a key.
echo.
echo Did you remember to clear ALL merchant quests and the river pirate 
echo quest on existing save files?
echo.
echo If you did not, press ctrl-c and type "y" now.
rem Pressing ctrl-c cancels the current command, which in this case is 'Install.bat'.
echo.
echo.
pause
doskey /macrofile=macros.txt
rem This loads macros, which are similar to batch files, from a file.
rem I'll post the macros below.
call hugemod.bat
rem 'Call' executes another batch file before returning to the line after 'call'.
rem I'll putthe code for that beneath the current file.
7za x "Mag7_v[1].14.zip" -o%temp% -aoa -y
rem This is a command for the unzipping program I used.
rem There isn't much point explaining it, because you will likely use something else.
copy /y "%temp%Mag7_v.14costumes7.dds" "C:Program FilesMount&BladeTexturescostumes7.dds"
rem This copies files to other locations or names.
rem The '/y' makes the program automatically answer yes when it asks 'do you want to overwrite'.
rem The '%temp%' is a system variable that Windows fills in.
rem Use '%temp%' or '%tmp%' when dealing with files you will soon delete.
cls
rem This command just CLears the Screen.
echo Choose your version of Magninficent 7. Type "Berserkers",
echo "Knights", or "Raiders".
rem Each of those is a macro defined in the macros.txt file.
echo.
echo.
cmd
rem This creates a new command line.
rem If it wasn't there, the command line would simply close when done, and not let users type in the proper command.
Hugemod.bat
Code:
@echo off
7za x "hugemod.zip" -o%temp% -aoa -y
rem The same command as before, but it unzips a different file.
copy /y "%temp%homethanatosProgramshugemodMount&BladeCommonRes*.*" "C:Program FilesMount&BladeCommonRes"
rem '*.*' is the all files wildcard. '*' means any sequence of charecters, so '*.*' is any file, because all files match that sequence.
rem '?' is the any charecter wildcard, but it matches 1 and only 1 charecter. '22' matches '??', but not '?' or '???'.
rem The '*.*' is important. If I had a list of files instead of '*.*', then it would concatenate each file together into a new file named %last_part_of_the_path%.
rem Add a '' to the end of all folder paths to prevent this.
rem Anything between percentage signs is a variable, but only some are system variables.
rem '%ProgramFiles%' is one of those system variables.
rem I am going to make a slightly newer version that uses '%ProgramFiles%' instead of 'C:Program Files' to aid compatability, but it isn't very important.
copy /y "%temp%homethanatosProgramshugemodMount&BladeData*.*" "C:Program FilesMount&BladeData"
copy /y "%temp%homethanatosProgramshugemodMount&BladeModsNative*.*" "C:Program FilesMount&BladeModsNative"
copy /y "%temp%homethanatosProgramshugemodMount&BladeTextures*.*" "C:Program FilesMount&BladeTextures"
rd /s /q %temp%home
rem 'rd' is short for 'remove directory'. It deletes folders, but only if they are empty.
rem The '/s' removes files in the folder first. It is the same as 'cd subdir&del *.*&cd..&rd subdir'.
rem The '/q' gets rid of the 'are you sure' warning that comes with '/s'.
rem FYI, & is used ON THE COMMAND LINE ONLY to execute multiple commands.
rem It does not work in batch files
rem Since this file was accessed by 'call' from Install.bat, the sequence of logic returns to it.
rem Remember that it basically gives you a command line, so there is no point looking back.
Macros.txt
Code:
berserkers=copy /y "%temp%Mag7_v.14berserkers*.*" "C:Program FilesMount&BladeModsNative"$tcls$tcall cleanup.bat
knights=copy /y "%temp%Mag7_v.14knights*.*" "C:Program FilesMount&BladeModsNative"$tcls$tcall cleanup.bat
raiders=copy /y "%temp%Mag7_v.14steppe_raiders*.*" "C:Program FilesMount&BladeModsNative"$tcls$call cleanup.bat
rem I'm writing 'rem' since it is most logical, but as this isn't really a batch file, I don't know what it does.
rem Anyways, this is the file loaded by doskey to create the macros.
rem The last comment in Install.bat tells the user to type one of these macros.
rem The name of the macro is the part before the '='. Type the name to use a macro.
rem '$t' is a special charecter used in macros to enter multiple commands.
rem Each macro basically replaces the current files with the proper modded files for the version the user selects.
rem The last command in each macro brings us to our last file.
Cleanup.bat
Code:
@echo off
rd /s /q %temp%Mag7_v.14
rem This removes the files used earlier because they are no longer necessary.
cls
rem I used this to remove the visual garbage spewed out from the various copy and extract commands.
rem I could have added ' > null' to the end of each line so that the garbage never even shows up.
rem But then the user would have no indication of whether or not the script had frozen or was active.
echo Magnificent Seven has now been installed.
echo.
echo Start a new game to see the effects immidiatly, or wait several game days
echo in a existing file.
echo.
echo.
echo Thank you for using my install script. PM me any errors you recieve.
echo.
echo.
pause
exit
rem Exit closes the command line that I opened earlier with the 'cmd' command.
rem There are actually two command windows open, but the batch file closes the first one when it is finished.
rem This of course assumes that you double-clicked the file.
rem If you ran it from the command line, you would be back at it, but still with the strange prompt.
rem Anyways, that's it! You're done!
rem If you paid attention, you now know how to build your own installers.
rem Lookout for anything new I think up and bring myself around to writing.
rem Happy Codeing!

Edit: Just a couple things I forgot to explain:
  • The program I used for unzipping in this program is called 7-zip. '7za' is the standalone command line client. I distributed it with the batch files.
    As an FYI, I'll explain the command '7za x "Mag7_v[1].14.zip" -o%temp% -aoa -y'. '7za' starts the 7za.exe program in the current directory. 'x' means extract to proper folders. 'e' would have thrown all files into the same directory. The thing in the quotation marks is just the filename of Mag7. '-o' makes the program extract into the specified directory, instead of the current one. '-ao' somehow means 'overwrite mode', and the extra 'a' makes it skip the question dialog. It automatically 'Acepts' whenever it encounters an existing file. '-y' does basically the same thing. It really means 'answer yes on all questions', but the program doesn't ask many other questions.
  • That extrenious text that appears beneath the echoed comments is a result of the 'cmd' command. If you run a command window from startrun, you will get the same text.
  • I used a lot more double-quotes than is usually necessary because the ever-present ampersand is often interpreted as some sort of command charecter, as I found out during testing :roll: .
  • I change case at many points. Windows is not case sensitive.
I think that's it.
 
compfreak said:
So did it work? I checked them on my computer but I don't know if other versions of windows will interpret it properly. They should, but I need to make sure.
lol i told you i could screw up my M&B.... i broke it lol, well what happened is i extracted it to a seperate folder and used the installer and now when i try and run M&B it says get_shader failed for: iron shader
 
Offcourse, mods that are really worth it because of the effort of the modders, should have a real .exe installer. Given that serious modders know how to create a simple setup.exe :roll:
 
Juno said:
compfreak said:
So did it work? I checked them on my computer but I don't know if other versions of windows will interpret it properly. They should, but I need to make sure.
lol i told you i could screw up my M&B.... i broke it lol, well what happened is i extracted it to a seperate folder and used the installer and now when i try and run M&B it says get_shader failed for: iron shader
Yeah, I made it work with zipped files because I thought it was easier. Today I probably can't work on this too much since I'll be at school, but I think I'm going to have to add several conditionals to prevent this kind of thing. I think I only need 'if exist %extracted folder name% goto after_extraction', 'if not exist whatever.zip call location.bat' and 'if not exist %mount&blade_path% call location2.bat'. I have to figure out what to write in location.bat and location2.bat though...

Thorn said:
Offcourse, mods that are really worth it because of the effort of the modders, should have a real .exe installer. Given that serious modders know how to create a simple setup.exe
Not necessarily. The mod tools for this particular game require no programming at all. So not all of them may know how to write programs. Then there is also the problem of ease of writing and compiling. I have Visual Studio, but I used batch files because they are much smaller and simpler for such a short job. Trying to write this in Visual Basic would have taken me much longer, since the command line is pretty lenient. Some people might also have the problem of knowing vb or c++ or java but not having access to a compiler for the language they know. Of those, c++ is the only language with widely available free compilers, isn't it?
 
After reading this thread I started experimenting with NSIS. I tried the zip2exe function and managed to create a working installer for hugemod v2 without any scripting. The exe is actually smaller than the original zip file. I recommend giving this software a try if you plan creating mods.
 
Intrigueing... I have a question for everyone. Would you rather I use this program to make pretty graphical installers, or do you want to keep the batch files because they look so totally 1337 8) ? I've figured out the solutions to the problems I've had,so they will both have the same capabilities. The difference will be how it looks. Your opinions?
 
Back
Top Bottom