B Tutorial Other How to make an installer for your mod

Users who are viewing this thread

monnikje

Master Knight
Hello everyone,

Suppose you've created your own mod, and shared it with the rest of the world like so many have done before. But people complained that they found it very difficult to install, or you just want to provide a service to make it as easy as possible. In short, you want to create an installer which automatically installs your mod to the right place. But you have absolutely no clue on how to do it, and have no experience with installer creators or such programs. If that's the case, you're just like me. But don't worry any longer, for in this tutorial I'm going to explain you how to do it. I might even teach you cool stuff with the installer that you hadn't thought of.

I'm by no means an installer guru. Actually, I'm learning myself how to do it by writing this tutorial. So maybe there are other and better ways to get things done. But I don't know them (yet), so this tutorial is what we're stuck to.

I based this tutorial on a few other tutorials I found online. I translated them to use with Warband, but it will also work for Mount & Blade and With Fire and Sword, and any upcoming version of the Franchise. These are the sources I used:
Creating an installer for your Fallout 2 mod
Inno script tutorial for Civilization 4

Now, let's get on with the learning stuff, shall we?

Step 0: Create your mod

Before you even think of trying to create an installer for your mod, you should have created the mod you want to install. I assume you can pull that off with success: else there are a lot of other tutorials on the forum to help you create the most awesome mod you can think of.

In this tutorial I need an example, so the first thing I'm doing is creating a mod. I'd like to keep things simple, so this example mod will just add one new song to Warband. A mod adding one song needs to have the following:
  • A modified music.txt which will be placed in the main mod folder.
  • The new song, which will be placed in the Music folder in our mod.
  • The rest of the native files, to get the mod running.
Let's call this mod Awesome song. So our goal is that the installer copies the 'Native' folder, renames that copy to our mod name (Awesome song), replaces music.txt by our own version and puts the song in the subfolder 'Music'. That sounds doable, but how to do it?

To get a visual, our mod is structured like this:
picture00a.jpg


Step 1: Install the right programs

There are quite a few programs out there that can create installers. For this tutorial I'll be using Inno Setup, a free and easy to use application that can do everything we want it to do. Since it's actually just a script compiler, we might want to install a gui script generator, to have a handy and workable Graphical User Interface. We use ISTool for this. If we want to compress things using a separate program, we can also use 7zip (I use that from part 4 hence). Furthermore I advise to use Notepad++ (which I use in part 5) but that isn't strictly necessary.

Inno Setup: http://www.jrsoftware.org/isinfo.php
(I'm using version 5.4.2)
ISTool: http://www.istool.org/
(I'm using version 5.3.0.1)
7zip: http://www.7-zip.org/
(I'm using version 9.20)
notepad++: http://notepad-plus-plus.org/
(I'm using version 5.9)

Step 2: Create the installer

Now that we've got a mod and we have the right programs installed, we're going to create our own installation program. In this tutorial I will handle several ways to create more and more complicated installers, each one in a new post. Here's a handy overview. Just click on what you want to learn:
 
Part 1: Create a simple installer

I assume you have your mod ready (in the case of this example I use the mod Awesome song) and all the programs installed. Warning, this part is very picture heavy!

Step 1: Open ISTool

I think this is a logical step. Let's open the program, and immediately save our project with File -> Save As
It looks like this:

picture01a.jpg


Step 2: Adding the files of our mod

Now we just drag and drop all the files and subfolders into the 'Files and Dirs' section. It now looks like this:

picture01b.jpg


As you can see, all the files in the subdirectory are also listed. Next to the filename we see the destination. awesome_song.mp3 is this listed to go into the subdirectory 'Music'. That's exactly what we want. Cool!

Step 3: Adding the Native files

We don't just want our files to be copied to the Modules directory, we also want to have all the Native files (except music.txt, for we've got our own) copied into our mod directory. That way we can immediately play with it once we installed the mod. To do this, we go to our Native module directory, and drag and drop all files there. Then it looks like this:

picture01c.jpg


But wait! Now we've got the Music subdirectory and our music.txt listed twice! Luckily we can just delete these second instances without a problem.

Step 4: Setting each file's destination property

At the moment the program thinks all the files, even the Native ones, are actually in our pre-install mod directory. This is not true, so we need to set the right properties for each file. There are a lot of files now, so this might take a while. Right click on for example factions.txt, and click 'Properties'. Or just push alt-enter. You'll get the properties screen:

picture01d.jpg


I entered the following:

Source: {app}\Modules\Native\factions.txt
Dest. dir: {app}\Modules\Awesome song\
Dest. name: factions.txt

Furthermore I ticked 'External' (meaning that this file is not from within our installation pack) and 'Skip if source doesn't exist' (we don't want it to search for a non-existing file till the end of days).

As you can see, I use the Warband installation directory as {app}, and point the files to the right module in the Modules folder. I get the Native files from the Native Module, and copy them to our Awesome song mod.

Also, I set a destination name. I kept it the same as the original file name, but we could rename files this way.

For the two files of our mod I use:

Source: Awesome song\music.txt
Dest. Dir: {app}\Modules\Awesome song\
Dest. name: music.txt

and:

Source: Awesome song\Music\awesome_song.mp3
Dest. Dir: {app}\Modules\Awesome song\Music\
Dest. name: awesome_song.mp3

Do NOT tick any options with these two files.

The folders also need some editing of the properties:

picture01e.jpg


We see here that we don't need to insert a Source directory, only a destination: if the directory doesn't exist, it will be created automatically. I thus inserted:
Name: {app}\Modules\Awesome song\Music
for our Music folder. I did the similar thing with the other directories.

With especially a lot of scene files, it can be a tedious job. Now imagine what a drag this would be if you'd actually builded a mod with a few thousand textures, songs, sounds, resources and whatnot!

After doing all the files, our screen looks like this:

picture01f.jpg


Yeah, I know: the scrollbar shows that I've got less files in the example now that I had before. I just didn't want to spend an hour going through all the 535 scenes: that will not matter for this demonstration. But you, unfortunately, will have to do all that work!

Step 5: Settings

Now that we've listed all the files we want to install, it's time to adjust some settings. Because the installer still doesn't know where he should install!
To do this, we click on the 'Options'
button, after which the setup options appear:

picture01g.jpg


This first panel displays the information needed for the compiler. Where do you want your compiled setup file to end up? Let's just use the directory we're working in.
Our next step is to go to the Application tap. Here we insert just some info on our mod. If we had created a license file, we would have appointed it over here.

picture01h.jpg


Next we go to the App Directory tab, to insert the standard Warband installation directory. You might have installed it somewhere else, but that doesn't mean others have too!

picture01i.jpg


We now did all the necessary steps, let's compile! We do that by clicking the Compile button, which I pointed out over here:

picture01j.jpg


It will compile pretty quickly (we made a very tiny installer after all), so within a few seconds you'll see this:

picture01k.jpg


Of course we want to test! The first screen looks like this:

picture01l.jpg


We immediately see that I could have done better in the naming process a bit earlier on. Aw well... too bad. We continue throughout the installation, and in the end, when all is finished, we have a look at our Warband folder. And lo and behold! It's all there!

picture01mk.jpg


Our installer works, and we can now install our Awesome song mod by just clicking 'Awesome song setup.exe'. But our installer is still pretty standard and boring. In the next part we're going to personalize it.
 
Part 2: Personalize the installer

I assume you have followed all the steps in the previous part, and understand it all. Now we're going to use the same installer project we used in that part, but fancy it up. Warning, this part is also very picture heavy. Let's first have a closer look at the options. How do we want our installer to look like?

Compiler

I already told you about the important settings in the previous part. But what I didn't elaborate, were the things I wrote at 'Version Information', at the right side of this tab. What you write here will be displayed in the properties of the installer. Let me show you:

picture02a.jpg


Information like Description, Version and Copyright are thus displayed in the properties of the setup.exe. Not stricly necessary, but still a nice gimmick.

Disk Spanning

This tab allows you to split the installer into several smaller files, so that you can spread it over several floppy's, cd's or other media carriers. That's of no importance for us now.

Application

picture02b.jpg


In the Application tab, we can set up info that is displayed during the installation. Here's information about the - for us - important things:
  • Application name: Here we type the name of the application, without the version number.
  • Application version: This is actually the name + the version number.
  • Application copyright: A copyright notice that is displayed during the installation in the bottom right corner of the installation screen.
  • Extra disk space required: During the previous part, we saw that the installation size was 2.4 MB. That wasn't right! I checked the folder later, and - even without all these scenes - it was 8 MB. In here we can raise the size displayed with a number in bytes. So if we want to raise the number with 5 MB, we need to add the number 1024*1024*5 = 5242880. So let's do that!
  • Info after file: The contents of a .txt or .rtf file specified here are displayed after a succesfull install.
  • Info before file: A readme file that is displayed before selecting the installation directory.
  • License file: Here you specify a file containing a license the user has to agree too. If you don't select any license, the user can install without agreeing to something.

User Info

Here you can specify a username, organisation and serial key that should be entered. Unless you want to make a commercial mod (for which you will need to have permission from TaleWorlds), this is not necessary, and might even be a hindrance.

App Directory

In the previous part I entered a standard Warband installation path which will be displayed during installation. I don't know about you, but I personally don't install my games into the standard Program Files folder. So what I want here, is the installer to search for the path where Warband is installed, and suggest to install the mod over there. For example, my Warband is installed at the following path: C:\lan\Mount&Blade Warband 1.143\ So how can we achieve this?

Since the uninstaller seems to know where Warband is located, despite the fact that it can be installed anywhere, there must be a reference to it in the registry. After some searching I didn't just find my serial there, but also a registry key referring to the Warband folder. This is what we will use to get our mod installed at the right place.

After finding the right registry value, we need to tell the installer to actually look for it. We can do that by inserting a constant at the Default directory name. If we use {pf}, for example, the installer will look at "C:\Program Files", or if we use {sys} it will go looking in the Windows directory. We want it to go looking in that registry value, so we use the following constant:

{reg:HKLM\Software\Mount&Blade Warband,}

The "reg:" part tells the installer that it should look into the registry, followed by the path where to look. After the comma you specify in which registry entry the installer should look. I didn't put anything there, because Warband (and normal Mount&Blade, and With Fire and Sword) all use the (Default) entry to insert the installation path of the game. By leaving it blank, the installer looks for the default entry.

Here's how it looks like in the options:

picture02c.jpg


Appearance

This is where we shape the look of the installer. We can select an image to be displayed, along with another smaller image, and define some colours. But if we want to have a cool picture in our installation, we first need to make one! Using a graphics program of my choice (Paint does a good job), I created a logo:

logoam.png


Maybe a bit big, but better oversized and reduced on use then so small you can count pixels. But to be sure I also made a smaller version of it (which I mirrored so we can easily see where the big and where the small versions are used):

logosmallxh.png


Please note that the images you use for the installer must be bitmaps. While I were at it, I also saved the small version as an icon, an .ico. We can use this icon for our setup!

I saved these logos in a special folder I made, 'Installation Files'. All the new files I make and use in this part I set in that folder: best to keep all the specially assigned installation files in a separate folder, so that you can later find it quickly when you want - for example - to change the license notes.

Here's what our option screen looks like:

picture02d.jpg


Now that we've customized our installer, let's have a look at the job it does!

First, look in the explorer:

picture02ev.jpg


As you can see, it uses our icon! Now, let's try to install the mod. We click the installer:

picture02f.jpg


The big logo is used here. It's a little stretched, but we hadn't unchecked that box, so that's fine. We also see that our application name is used in the title, and our application version in the text. We click next.

picture02g.jpg


Then we get the license agreement which we had loaded from a separate textfile. Also, we see that in the upper right corner our smaller version of the logo is used. We of course accept the agreement, and click next.

picture02h.jpg


Then we are brought to the readme displayed before selecting our installation directory. We read it, and click next.

picture02i.jpg


As promised, we're now at the place where we must select our installation directory. See how it has automatically selected my Warband folder! We click next.

picture02j.jpg


Now we are ready to install, so we click Install. It installs so fast (because it's a very small mod) that I hadn't had time to take a screenshot of it.

picture02k.jpg


Now the readme after selecting the directory is displayed. We click on Next (like there is anything else we can click on).

picture02ly.jpg


The installation is done! And once again that large logo is displayed. We've now learned ways to make our installer look cooler and more personalized. But there is more we can do. In the next part we're going to try to install multiple versions with the same installer.
 
Part 3: Multiple versions with the same installer

I assume you have read the previous two parts, understood it ánd saved your project file, for I'm going to continue with mine.

For this part, I'm going to explain to you how we can install multiple versions of the same mod using the same installer. For example, let's say that I created another song, called stupid_song.mp3. I want the user to be able to install just the awesome song, just the stupid song, or both. For each of the three options I created a separate music.txt. The file structure looks like this:

picture03a.jpg


Among the sections we used to select our files and such, there is one that I have ignored so far: the Script section. All the things we did so far with our nice graphical user interface, are actually just lines in a script that has been written. Let's look at it:

picture03b.jpg


We see that the scripting lanuage is actually pretty straight forward: the section with [Dir] defines all directories that have to be created, the [Setup] section has all the options we entered last part, and out of view of this picture is the [Files] section, which has all the files which need to be installed listed. I haven't discovered a nice way using the gui to create what we want, so we'll have to write some code ourselves. Don't worry, I dare say it's even easier than using the module system!

I said that we now have three mods: Awesome song, Stupid Song and Supadupa song. These three mods all have different music.txt-files, but share the same two songs, and of course the native files. It's a bit unnecessary for our installer to have the same file twice, so we want that once the user makes a choice, the installer selects automatically the right files to be installed. With that in mind, our first task is to create an option for the user to choose a version. We can do that by creating a new section, called [Types]. We scroll up, to the beginning of our installer script, and insert the following lines:

Code:
[Types]
Name: "awesome"; Description: "Awesome song"
Name: "stupid"; Description: "Stupid song"
Name: "supadupa"; Description: "Supadupa song"
Name: "custom"; Description: "Custom"; Flags: iscustom
[Components]
Name: "awesome"; Description: "Awesome Files"; Types: awesome; ExtraDiskSpaceRequired: 5242880
Name: "stupid"; Description: "Stupid Files"; Types: stupid; ExtraDiskSpaceRequired: 5242880
Name: "supadupa"; Description: "Supadupa Files"; Types: supadupa; ExtraDiskSpaceRequired: 5242880
[Files]
Source: Awesome song\music.txt; DestDir: {app}\Modules\Awesome song\; DestName: music.txt; Components: awesome
Source: Stupid song\music.txt; DestDir: {app}\Modules\Stupid song\; DestName: music.txt; Components: stupid
Source: Supadupa song\music.txt; DestDir: {app}\Modules\Supadupa song\; DestName: music.txt; Components: supadupa
Source: Supadupa song\Music\awesome_song.mp3; DestDir: {app}\Modules\Awesome song\Music\; DestName: awesome_song.mp3; Components: awesome
Source: Supadupa song\Music\stupid_song.mp3; DestDir: {app}\Modules\Stupid song\Music\; DestName: stupid_song.mp3; Components: stupid
Source: Supadupa song\Music\awesome_song.mp3; DestDir: {app}\Modules\Supadupa song\Music\; DestName: awesome_song.mp3; Components: supadupa
Source: Supadupa song\Music\stupid_song.mp3; DestDir: {app}\Modules\Supadupa song\Music\; DestName: stupid_song.mp3; Components: supadupa

The code now looks like this:

picture03c.jpg


I added the following:
  • [Types]: These are the names for the different installation choices. For example, 'Full installation', 'Basic installation' and 'Custom installation' could be choices you normally find here. I made one choice for each version I have, and one 'custom' option (there may only be one of this kind). This custom option allows you to select your own components. As you can see, it's the only one with a flag: flags are there to give the options special properties, in this case making this option custom.
  • [Components]: These are the different components that get installed. For example, you can have a component with the main files, the help files, the music, the extras. Each component is associated with one or more types: when you then select a type to install, the components you marked are selected for the installation. As you can see, I also gave each component some extra space it requires for installation. Ithus removed the ExtraDiskSpaceRequired from the setup.
  • Then I added to each file (and directory) the corresponding component. I thus gave the music.txt file from the Awesome song directory, the component 'awesome'. This means that if the user selects to install the Awesome song mod, this file will be installed. But not when the user selects one of the two other mods! Because of this I had to make some double entries, especially with the music: one entry for each different destination directory (awesome_song.mp3 can be placed in the Awesome song mod, but also in the Supadupa song mod). I did the same for the native files I copy: I made a copy for each destination directory. Don't worry about multiple copies enlarging your installer size: if you make two entries of the same file, Inno is smart enough to only save one copy of that file in the installer, and use that copy henceforth.

Now, to watch the result of this, we compile and install. The first steps of the installer are the same as in the previous section, so I'm not going to display them. At a certain moment we get to the installation directory:

picture03d.jpg


We see that the disk space requiered is greatly reduced since I removed the ExtraDiskSpaceRequired from the setup. Don't worry, for we now have a new next step:

picture03ei.jpg

picture03f.jpg

picture03g.jpg


There is a new screen, which allows us to choose which version to install. We can choose form the scrolldown menu, as is displayed in the second picture, or we can select multiple versions to install at the same time (then our choice automatically becomes custom) by selecting multiple different components. We can now see why I removed the ExtraDiskSpaceRequired from the setup: the diskspace requierments are more accurate over here when selecting components. Once we're done, we click on next:

picture03h.jpg


We then get to the 'Ready to Install' screen, where we now see - besides the installation directory - the version we chose to install, and which components it installs. When we click Install, it installs the versions we want.

In the next part we're going to compress our files even further than the installer can using 7zip.
 
Part 4: Compressing the files

I assume you have read the previous three parts, understood it ánd saved your project file, for I'm going to continue with mine. I also assume you installed 7zip.

In this part we're going to pack the files in separate 7zip files. This method makes the installer approximately ten percent smaller. We could have also used other compression programs, like winrar or winzip, but I personally prefer 7zip. We then are going to change the installer to install these compressed fiels, and to extract them. But we must assume that the user has not installed 7zip, so these compressed files must be self-extractables.

Unfortunately it seems to be a problem for extremely large mods (larger than 2 GB) to use this method. So if you've builded an extremely large mod like I did, you won't be able to do this step.

The first thing to do, is to compress the files we want. We rightclick on the file and select 7zip:

picture04a.jpg


My apologies for having things in Dutch: since my windows version is in my native language, there's not much I can do about it at the moment. The option I select here is 'Add to an archive'. Once I select that, the 7zip screen pops up:

picture04b.jpg



You see here a screen with several options to compress. I selected the 7zip archive format (7z), the best compression level possible (Ultra), a compression method (LZMA) and kept the other options at their standard settings. But on the right there is a very important checkbox to check: the red arrow points towards it. 'Create SFX archive'. This tells 7zip to not just compress the file, but to create a self-extractable. This means that you can extract the file even without having installed 7zip (or any other compression program) installed on your system. Exactly what we want! We do this for both the songs:

picture04c.jpg


I made two separate archives, because there are multiple versions that use different songs. I also know that mp3's are already very compressed, but that doesn't matter for this tutorial.

Now that we created these self-extractable archives, it's time to change in our installer the files used:

picture04d.jpg


I changed all mentions of '.mp3' to '.exe', since we want to use the self-extractables and not the original files. The installer will now take those instead of the mp3's and put them in the right place. But we're not there, for we want the installer to also extract those files. To do that, we need to tell the installer to run those files. We do that like this:

Code:
[Run]
Filename: "{app}\Modules\Awesome song\Music\awesome_song.exe"; Components: awesome; Parameters: -y
Filename: "{app}\Modules\Stupid song\Music\stupid_song.exe"; Components: stupid; Parameters: -y
Filename: "{app}\Modules\Supadupa song\Music\awesome_song.exe"; Components: supadupa; Parameters: -y
Filename: "{app}\Modules\Supadupa song\Music\stupid_song.exe"; Components: supadupa; Parameters: -y

  • Filename: This is the path and name of the extracted application.
  • Components: The same components we used before.
  • Parameters: Here we can give some command line parameters - instructions - to the running of that application. By telling it to run with "-y" we say that these self-extractors should unpack without interference from the user, a so called 'switchless' installation. In other words, the installer will extract the files without asking the user where to put these files.

Now there is only one thing left to do: to remove those installed 7zip files once the songs are extracted from them. To do that, we need to give these files a Flag, called 'deleteafterinstall'. This tells the installer to delete this file once it's done with installing the mod. In this screenshot I pointed a big arrow to these flags:

picture04e.jpg


With this code inserted, we made our installer use 7zip files and extract them itself. In the next part we're going to automate it all: we'll create a batch file that will automatically create the installer for us.
 
Part 5: Automatic installer creation

I assume you have read the previous four parts, understood it ánd saved your project file, for I'm going to continue with mine. I advise you to use Notepad++ for this part, but it isn't strictly necessary: you could also use notepad, or any other program that edits texts.

In this
part we're going to automate the process of creating an installer. Why? Because I'm lazy! And I want my lazyness to spread across the globe. What I want, is that when I click on one batch file, automatically the right files get packed with 7zip, and then Inno automatically creates an installer for me. To do this, we must create a batch file and edit it. We create a new file, and rename it. The extension needs to be changed to ".bat", like this:

picture05a.jpg


As you can see, I created the batch file in the Installer Files directory. Then we open the batch file in our favourite editor (notepad++ in my case) and insert the following lines:

Code:
"C:\Program Files\7-Zip\7z.exe" a -mx9 -t7z -sfx "..\Supadupa song\Music\awesome_song.exe" "..\Supadupa song\Music\awesome_*.mp3"
"C:\Program Files\7-Zip\7z.exe" a -mx9 -t7z -sfx "..\Supadupa song\Music\stupid_song.exe" "..\Supadupa song\Music\*.mp3" -x!"..\Supadupa song\Music\awesome_*.mp3"
"C:\Program Files (x86)\Inno Setup 5\Compil32.exe" /cc "..\Awesome song.iss"
del "..\Supadupa song\Music\awesome_song.exe"
del "..\Supadupa song\Music\stupid_song.exe"
pause

It looks like this:

picture05b.jpg


Let's go by the lines one by one:
[list type=decimal]
[*]Archive awesome songs: In this line we say to 7zip to add all awesome songs to a self-extractable archive. First we say where 7zip is installed ("C:\Program Files\7-Zip\7z.exe"), then we give it a command, in this case to archive (a). Next we use several switches to tell 7zip how it should archive: compress with ultra dense compression (-mx9, for less dense compression methods we use -mx7, or -mx6, etc), use the 7zip compression method (-t7z, we could also use rar with -trar or sip with -tzip or any other compression method we like) and create a self-extractable (-sfx, the same letters we checked when we used a graphical user interface). Then we tell the name of the archive, and where to put it ("..\Supadupa song\Music\awesome_song.exe") and finally what files to include: all files starting with 'awesome_' and ending with '.mp3' ("..\Supadupa song\Music\awesome_*.mp3")
[*]Here we do the same, but in this case we add all mp3 files, except the ones starting with 'awesome_' (-x!"..\Supadupa song\Music\awesome_*.mp3").
[*]Compile Inno: Then we compile our Inno source. We first define where Inno is installed ("C:\Program Files (x86)\Inno Setup 5\Compil32.exe"), then say that it must compile (/cc) and finally specify what file it must compile ("..\Awesome song.iss").
[*]Delete the awesome_song.exe: since it's in the installer now, it's not needed anymore.
[*]And delete the stupid_song.exe.
[*]pause: This tells the batchfile to not continue until any key is hit. In this case, the window will only close after we hit a button.
[/list]

A note: When I say ".\" it means 'Check in this directory', and when I say "..\" it means 'Check in the parent directory.'

Now that we created the batch file, it's time to test if it works. To make sure that all awesome songs are installed to the Awesome song mod and the other songs to the Stupid song mod, and every song into the Supadupa song mod, I made two more songs, awesome_song2.mp3 and insane_song.mp3:

picture05c.jpg


Now when we click the batch file, we see the following happening:

picture05d.jpg


As we can see, there are no errors, so it should have worked. When we look in our main Installer directory, we indeed see that an installer has been created:

picture05e.jpg


When we click this installer, it installs just the way we expect it to install. And when we check the installation directories, we indeed see that the right songs have been put in the right folders:

picture05f.jpg


We have now create a batch file that automatically creates an installer for our mod, which offers the option to install several versions of our mod automatically into the right Warband folder. I think that's pretty cool! Since I learned to do this by writing this tutorial (I honestly had no clue on how to do it when I started writing), I'm sure that there are better ways to do it, and experienced people may be able to point them out. Despite that I hope this tutorial has been usefull for you.

Just as I was about to finish this tutorial, I discovered a special Warband Mod Installer Script for Mod Authors by Janus. I haven't tried that one yet, so I have no clue on how to get the same results with that program as I gotten with this one, but maybe someone else feels the urge to write a tutorial about it.
 
I'm about to try this out for a little texture update for my regiment in Napoleonic Wars... Saves me having to explain to 10 year olds from scratch how to navigate windows!  :razz:
 
I have one question, and in essence I need the answer to it in order for this installer to be of use to me.

Is there a way to make the installer search for the Warband directory and install there? I ask this because I don't want people to have to find the directory if they have 64-bit windows or the retail version.

Thanks in advance
 
Yes, there is :smile:. In Part 2 of the tutorial I covered this. But so you don't have to stroll through all the text and pictures, here's the explanation:
monnikje said:
App Directory

In the previous part I entered a standard Warband installation path which will be displayed during installation. I don't know about you, but I personally don't install my games into the standard Program Files folder. So what I want here, is the installer to search for the path where Warband is installed, and suggest to install the mod over there. For example, my Warband is installed at the following path: C:\lan\Mount&Blade Warband 1.143\ So how can we achieve this?

Since the uninstaller seems to know where Warband is located, despite the fact that it can be installed anywhere, there must be a reference to it in the registry. After some searching I didn't just find my serial there, but also a registry key referring to the Warband folder. This is what we will use to get our mod installed at the right place.

After finding the right registry value, we need to tell the installer to actually look for it. We can do that by inserting a constant at the Default directory name. If we use {pf}, for example, the installer will look at "C:\Program Files", or if we use {sys} it will go looking in the Windows directory. We want it to go looking in that registry value, so we use the following constant:

{reg:HKLM\Software\Mount&Blade Warband,}

The "reg:" part tells the installer that it should look into the registry, followed by the path where to look. After the comma you specify in which registry entry the installer should look. I didn't put anything there, because Warband (and normal Mount&Blade, and With Fire and Sword) all use the (Default) entry to insert the installation path of the game. By leaving it blank, the installer looks for the default entry.

Here's how it looks like in the options:

picture02c.jpg
 
monnikje said:
Yes, there is :smile:. In Part 2 of the tutorial I covered this. But so you don't have to stroll through all the text and pictures, here's the explanation:
monnikje said:
App Directory

In the previous part I entered a standard Warband installation path which will be displayed during installation. I don't know about you, but I personally don't install my games into the standard Program Files folder. So what I want here, is the installer to search for the path where Warband is installed, and suggest to install the mod over there. For example, my Warband is installed at the following path: C:\lan\Mount&Blade Warband 1.143\ So how can we achieve this?

Since the uninstaller seems to know where Warband is located, despite the fact that it can be installed anywhere, there must be a reference to it in the registry. After some searching I didn't just find my serial there, but also a registry key referring to the Warband folder. This is what we will use to get our mod installed at the right place.

After finding the right registry value, we need to tell the installer to actually look for it. We can do that by inserting a constant at the Default directory name. If we use {pf}, for example, the installer will look at "C:\Program Files", or if we use {sys} it will go looking in the Windows directory. We want it to go looking in that registry value, so we use the following constant:

{reg:HKLM\Software\Mount&Blade Warband,}

The "reg:" part tells the installer that it should look into the registry, followed by the path where to look. After the comma you specify in which registry entry the installer should look. I didn't put anything there, because Warband (and normal Mount&Blade, and With Fire and Sword) all use the (Default) entry to insert the installation path of the game. By leaving it blank, the installer looks for the default entry.

Here's how it looks like in the options:

picture02c.jpg

Sorry for that, this tutorial was really helpful! Thanks a lot for putting the time in to do it!

Also I realised that you can have multiple "components" for each file and multiple "types" for each "component". They just need to be separated by a space. So an example would look like this:
[Types]
Name: "full"; Description: "Full Download"
Name: "awesome"; Description: "Awesome song"
Name: "stupid"; Description: "Stupid song"
Name: "custom"; Description: "Custom"; Flags: iscustom
[Components]
Name: "awesome"; Description: "Awesome Files"; Types: awesome full; ExtraDiskSpaceRequired: 5242880
Name: "stupid"; Description: "Stupid Files"; Types: stupid full; ExtraDiskSpaceRequired: 5242880
[Files]
Source: Readme\readme.txt; DestDir: {app}\Readme\; DestName: readme.txt; Components: awesome stupid
Source: Awesome song\music.txt; DestDir: {app}\Modules\Awesome song\; DestName: music.txt; Components: awesome
Source: Stupid song\music.txt; DestDir: {app}\Modules\Stupid song\; DestName: music.txt; Components: stupid
Source: Supadupa song\Music\awesome_song.mp3; DestDir: {app}\Modules\Awesome song\Music\; DestName: awesome_song.mp3; Components: awesome
Source: Supadupa song\Music\stupid_song.mp3; DestDir: {app}\Modules\Stupid song\Music\; DestName: stupid_song.mp3; Components: stupid

It would probably make sense in this situation to only have two types (full and custom)
 
Back
Top Bottom