M&B Mod Installer Script for Mod Authors (v1.9)

Users who are viewing this thread

Yep, just checked it myself and confirmed that while the music.txt file in the module folder works the Music folder isn't actually checked yet. I even tried adding in a "scan_module_music = 1" line into module.ini just to be sure, no dice.
 
Huh.  Hadn't ever occurred to me to ask that, but (checks Schattenlander's installer) no, it doesn't appear to do so at this time.  I can't believe it; without that, my players have been missing a decent chunk of the proper feel of my mod, and haven't known that they should be complaining about the lack.  Crap!  I'll have to fix that.  Thanks for asking your question, Audun.
 
Fixed!  Schattenlander installer updated to include the /language/en folder and all its files; I also made a patch installer using the same technique, so that players can grab just the missing files from their install.

I'm sure Janus will remedy this in the next release of the installer, but here's the skinny for those who wish to add in text-alteration support using the installer version 1.5...

In the "touch at your own peril" section of the installer script, locate the following:
Code:
  SetOutPath "$INSTDIR\Music"
  File /nonfatal /x *.bak /x *.orig Music\*.*

Immediately below this, with the exact same indentation as the lines above it, add the following:
Code:
  CreateDirectory "$INSTDIR\languages"      #Make sure language subfolder exists, create it if not
  CreateDirectory "$INSTDIR\languages\en"
  SetOutPath "$INSTDIR\languages\en"
  File /nonfatal /x *.bak /x *.orig languages\en\*.*

Now the installer will include all files from the /languages/en directory.  Extrapolate the obvious, if trying to include other languages than English.

I still can't believe I missed that.  They go from a menu which says "Read all the skill descriptions carefully - many of them have changed!" to a character sheet with all the skill descriptions exactly as they were in Native; argh.

Ah, well.  Fixed now.

- Hellequin
 
Hmm, good catch. Sorry that it was missing that folder. I've just updated it to version 1.6 to take care of this.
https://www.mbrepository.com/file.php?cid=3&id=46

This version of it will include any mod language subfolders, whether english, turkish, chinese, or any other language. The uninstall process (for mods which are set to actually create an uninstaller) was also modified so it deletes all such files.

For mod authors already using a previous version installer script, the update process is the same. Just copy everything above the "You probably shouldn't edit below this point" line from your old script over to replace the top portion of the new script file.
 
OK, a new release of version 1.7 of the script is available which changes a fair bit. Download it here.

The most notable addition is the ability of the installer script to check which version of M&B is installed and compare it against the version of M&B which the mod was created for. If they don't match, a warning message is given to the person installing the mod and they are given the option of continuing anyway or cancelling the installation. This should help in the future with people trying to install old mods on newer versions of M&B.
This new check is possible due to a new Registry entry for the M&B version which is now set by the M&B installer. The currently available M&B installer available on the TaleWorlds download page is updated to use this, along with supporting English/Turkish/Spanish languages within the installer.

For people wanting to update from previous versions of the installer, a change will be needed to add in the M&B Version setting in the upper options. Besides copying over everything below the "#You probably shouldn't edit below this point" line like usual for upgrading, you should add in this line from the new version to the uppermost settings:
Code:
!define MB_VERSION "808"           #The version of M&B the mod was created for, ex. "808" is version 0.808 of M&B.

If you want to test out what this version warning message looks like, you can change the version listed from "808" to something else like "809", and then compile and run the installer. It should give you the warning message.
If you want your mod to install on any version of M&B, you can comment out the MB_VERSION line to have it ignore the version checking.

Since older installs of .808 and previous M&B versions did not set the version in the Registry, if the version is not found there the installer will assume it is version .808 and compare accordingly.


The changelist for this version:
v1.7:
- New M&B version detection method based on M&B version stored in the registry. This will check the current version of M&B against the version the mod was created for, and warn the person installing that the mod was created for a different version of M&B. This M&B version checking is dependent on a new registry entry which the current M&B installer for .808 includes, which will be updated with each new M&B version.
- Modified "languages" folder usage so that it excludes subfolders which start with a ".", such as ".svn" folders.
- Shortcuts (in Windows, "Create Shortcut" method used on a file or folder) are now excluded from the files, as they really shouldn't be included in any mod package but previously were added by the script.
- Installation notes (in "install.txt") revised since much of it's info was outdated.
 
OK, since someone PMed me about it I'm going to try and make it more clear why it's a good idea to update to this latest version of the installer script.

If you don't update to it, as soon as the next version of M&B comes out (.810 or whatever), people who don't know any better will be downloading your .808 mod and installing it on the new version. They'll then get the usual type of error message whenever they try to play the mod, with Mount&Blade indicating that there is a missing file or so forth. That person will then be on the boards asking "Why doesn't the mod work? It gives me some file missing error! They need to fix it. How can I make it work?"
However, assuming you do update your .808 mod to use the updated installer script, you shouldn't have that problem. Anyone trying to install your .808 mod on a different (newer) version of M&B will get a warning message like this when they run the installer:
This mod was created for version 0.808 of Mount&Blade while you appear to have M&B version 0.810 installed. The mod will almost certainly not work on your current version and likely instead give an error message about a missing file when you try to play it. You should instead try to find an updated version of this mod.
Do you want to continue the installation anyway?
[Yes] [No]

So, that's what the M&B version checking feature is for.
 
Just a bit of a bump to say that this script still works, and for those who are newer and never heard of it.
With it you can put your mod into an easy installer EXE which handles the installation rather than a ZIP or RAR file. For an example of a mod using it, check out the Band of Warriors mod.
 
Yes, for instance the Hundred Years War mod uses it.

It does incorrectly identify 1.0+ versions wrongly (ex. 1.011 as .1011) though... I suppose I could release a new version to fix that.
 
It also appears the Steam version doesn't play nice and set Registry variables for the M&B installation path and the M&B version. See the version update notes below for more info on that.

Anyway...

v1.8 is now available. Download it from here.

v1.8:
- Updated version display to properly indicate newer versions, i.e. "1.011" instead of "0.1011".
- Added in detection method for Steam installations of M&B if it isn't found elsewhere; Steam annoyingly doesn't store the M&B path in the Registry, but it does store its own path, which is extrapolated from to get the Steam M&B installation folder.
- Version mismatch warning message is updated to indicate possible Steam installation if version match isn't found; sadly, Steam also doesn't store the M&B version number in the Registry either.
- Special case added in for 1.010 and 1.011 to have them detected as compatible.
- Installation notes (in "install.txt") again slightly revised.
 
Janus said:
It also appears the Steam version doesn't play nice and set Registry variables for the M&B installation path and the M&B version.

Same with Battle Size Changer.
 
M@ster-$ said:
Janus said:
It also appears the Steam version doesn't play nice and set Registry variables for the M&B installation path and the M&B version.

Same with Battle Size Changer.
I updated it shortly before I updated this. I assume you didn't check?
 
After fiddling around with Steam a bit to see if there's a better way to determine the M&B install path, I've found something interesting. It appears to keep a fake registry sort of thing going in the "steam\appcache" folder ("c:\program files\valve\steam\appdata" by default) for third party titles installed through Steam. For the M&B demo on Steam, the registry data is stored in the "app_22110.vdf" file in there for me. I expect M&B's app id on Steam is 22110, so that's probably constant; not sure if it's the same between the demo and the full version on Steam or not. That would bear investigation from somebody who has the full version of M&B on Steam.
This file includes pretty much all data normally stored by M&B in the Windows registry, including the M&B version. If I could be sure of the filename used to store that data being consistent between users and versions ("app_22110.vdf" in my case for the M&B demo), I could probably rig up better support for Steam installations of M&B.
 
OK, just checked their store page and it looks like the actual full game id for M&B is 22100, so not quite the same as the demo (22110).
http://store.steampowered.com/app/22100/

I'd still like it if somebody with the full release could confirm that the file used is different ("app_22100.vdf" as opposed to "app_22110.vdf").

EDIT: confirmed with the assistance of StrikeQ. I've also devised a way of reading the folder path and version of M&B from those "app_#.vdf" pseudo-registry files. I'll probably be releasing version 1.9 of this installer script in the next couple of days with full, robust support for the Steam versions of M&B (full or demo).
 
v1.9 is now available: Download

Same upgrade method as always: copy over the stuff you changed at the top of the file in a previous version, or even copy over the entire top section. Only the bottom section (which you generally shouldn't mess with anyway) has changed.

v1.9:
- Much more robust support for Steam installations of M&B, both full version and demo. Steam apparently stores pseudo-registry files which contain the M&B registry info (found in "<Steam_path>\appcache\" as "app_22100.vdf" and "app_22110.vdf"), so these are found and read. The install folder is therefore determined rather than guessed, and the M&B version number (ex. "1010"/"1.010") installed through Steam is also determined.
- Steam M&B version and any existing standard (TW) installation of M&B are now both checked against the version the mod is made for, since the Steam M&B version can now be found. If both installations exist and their versions both match the one which the mod was made for, the standard installation will be defaulted to instead of the Steam installation.
 
Back
Top Bottom