Warband Mod Installer Script for Mod Authors (v2.3)

Users who are viewing this thread

Nice script!

I just tested it, and have some suggestions (I know, nobody likes suggestions, so please bear with me):
1. If at all possible, make it run from any folder - let it read files from the module folder specified in the constants
2. Remove or make optional the section that copies files from Native - it's not necessary, the mod should be playable as it is, and any possible savings on size are not that great (and are hard to configure anyway).
3. I have a Steam installation that has a slightly different registry (and other people probably do as well), so in addition to reading the Warband path here:
ReadRegStr $RPATH HKLM "Software\Mount&Blade Warband" ""
... try reading it also here:
ReadRegStr $RPATH HKLM "Software\Mount&Blade Warband" "Install_Path"

Cheers,
MV
 
About the Steam Path, this is already in it. 
  ReadRegStr $SAPATH HKLM Software\Valve\Steam "InstallPath"  #SAPATH variable is Steam Path, so we can check if Warband was installed through Steam
  StrCmp $SAPATH "" CheckedSteam            #If the Steam registry entry was blank, Steam isn't present, so Warband obviously isn't there either
IfFileExists "$SAPATH\appcache\app_48700.vdf" 0 CheckDefSteamDir  #full version of Warband registry found under Steam?
  ${ReadSteamReg} "version" "$SAPATH\appcache\app_48700.vdf" "$SVER" #yes, so read the version and the folder name
  ${ReadSteamReg} "gamedir" "$SAPATH\appcache\app_48700.vdf" "$R0"
  StrCmp $R0 "" CheckDefSteamDir            #If we got nothing, can't find that way
      StrCpy $SPATH "$SAPATH\SteamApps\common\$R0" #set the full path based on the folder name
      IfFileExists "$SPATH\*.*" CheckedSteam #if the path exists, that confirms it
        StrCpy $SPATH "" #otherwise, reset the variable
  CheckDefSteamDir:
      IfFileExists "$SAPATH\SteamApps\common\mountblade warband\*.*" 0 CheckedSteam  #Steam is installed but couldn't get WB path; so, check default install path
    StrCpy $SPATH "$SAPATH\SteamApps\common\mountblade warband" #set the full path based on the folder name
  CheckedSteam:
  StrCpy $SAPATH "$PROGRAMFILES\Steam"            #Let's check the default Steam installation folder just to be sure
IfFileExists "$SAPATH\appcache\app_48700.vdf" 0 CheckDefSteamDir2
  ${ReadSteamReg} "version" "$SAPATH\appcache\app_48700.vdf" "$SVER"
  ${ReadSteamReg} "gamedir" "$SAPATH\appcache\app_48700.vdf" "$R0"
  StrCmp $R0 "" CheckDefSteamDir2
      StrCpy $SPATH "$SAPATH\SteamApps\common\$R0"
      IfFileExists "$SPATH\*.*" CheckedSteam2
        StrCpy $SPATH ""
  CheckDefSteamDir2:
      IfFileExists "$SAPATH\SteamApps\common\mountblade warband\*.*" 0 CheckedSteam2
    StrCpy $SPATH "$SAPATH\SteamApps\common\mountblade warband" #set the full path based on the folder name
  CheckedSteam2:
  StrCmp $RPATH "" 0 RegFine                      #If the Registry entry was present, continue
  StrCmp $SPATH "" 0 RegFine                      #If the Steam entry was present, continue
#uh-oh, neither the registry entry or Steam entry was present...
    MessageBox MB_ICONSTOP|MB_OK "Warband installation directory could not be determined from Registry or Steam game data! You should make absolutely sure the installation path is correct when asked."
    StrCpy $RPATH "$PROGRAMFILES\Mount&Blade Warband"    #Use default install path instead; hopefully it is correct
  RegFine:

  !ifdef WB_VERSION                            #if the WB_VERSION setting wasn't defined at the top, skip this version checking routine
StrCmp $RPATH "" +2                      #Is the regular (non-Steam) version of Warband present?
      ReadRegStr $RVER HKLM "Software\Mount&Blade Warband" "Version"  #yes, so set RVER variable to Warband version value stored in registry
    StrCmp $RVER "" 0 +2                      #If the Registry entry was blank, we can't see a version here
      StrCpy $RVER "[X]"
 
MadVader said:
1. If at all possible, make it run from any folder - let it read files from the module folder specified in the constants
What do you mean? Installers created using this script should indeed run fine from any folder.

MadVader said:
2. Remove or make optional the section that copies files from Native - it's not necessary, the mod should be playable as it is, and any possible savings on size are not that great (and are hard to configure anyway).
It would indeed be simple enough to add an option to the top section to disable that. I'll probably do that.

MadVader said:
3. I have a Steam installation that has a slightly different registry (and other people probably do as well), so in addition to reading the Warband path here:
ReadRegStr $RPATH HKLM "Software\Mount&Blade Warband" ""
... try reading it also here:
ReadRegStr $RPATH HKLM "Software\Mount&Blade Warband" "Install_Path"
Do you have only the Steam release of Warband installed, having never installed versions or updates provided directly by TaleWorlds or any other distributor? If so, could you send me a PM with all of the data contained in "HKEY_LOCAL_MACHINE\SOFTWARE\Mount&Blade Warband" (or "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mount&Blade Warband" if you're on a 64-bit OS) from your system?
 
Janus said:
MadVader said:
1. If at all possible, make it run from any folder - let it read files from the module folder specified in the constants
What do you mean? Installers created using this script should indeed run fine from any folder.
Sorry, wasn't clear enough: make the script run from any folder, so we can keep the script in a fixed folder, edit its mod name and exe filename if necessary, and run it every time we want to release. Right now, AFAIK, you need to copy the script and its files to the mod folder, then run it. In serious modding, you keep multiple versions of your mod with different mod names (e.g. "MyMod Beta 3", "MyMod V1.1" etc.).
Janus said:
MadVader said:
3. I have a Steam installation that has a slightly different registry (and other people probably do as well), so in addition to reading the Warband path here:
ReadRegStr $RPATH HKLM "Software\Mount&Blade Warband" ""
... try reading it also here:
ReadRegStr $RPATH HKLM "Software\Mount&Blade Warband" "Install_Path"
Do you have only the Steam release of Warband installed, having never installed versions or updates provided directly by TaleWorlds or any other distributor? If so, could you send me a PM with all of the data contained in "HKEY_LOCAL_MACHINE\SOFTWARE\Mount&Blade Warband" (or "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mount&Blade Warband" if you're on a 64-bit OS) from your system?
I only have one Warband installed, a Steam release bought in a store in Europe - no manual installs, no hacks - I let Steam do its work.
Here are the keys and values (the version should be 1131, but for some reason isn't - a mystery):
(Default) ""
Install_Path "c:\steam\steamapps\common\mountblade warband"
version 1124
 
MadVader said:
Sorry, wasn't clear enough: make the script run from any folder, so we can keep the script in a fixed folder, edit its mod name and exe filename if necessary, and run it every time we want to release. Right now, AFAIK, you need to copy the script and its files to the mod folder, then run it. In serious modding, you keep multiple versions of your mod with different mod names (e.g. "MyMod Beta 3", "MyMod V1.1" etc.).
Well, it's a trade-off in such a setup. You either have to copy the script files over, or you have to edit an additional line in the script with a full folder path and make sure you don't mess that path up. I think the former (and current) method keeps the script simpler for most users, where the latter method you're advocating is more complicated and unnecessary for most users. Additionally, I could see it being easier for mod authors using your method to accidentally re-release an older version of the mod by forgetting to update the path when working with multiple mod folders. It's harder to **** it up when you're working with the installer script required to be in the actual mod folder it's building from.
So, I'll pass on that idea.
 
MadVader said:
I only have one Warband installed, a Steam release bought in a store in Europe - no manual installs, no hacks - I let Steam do its work.
Here are the keys and values (the version should be 1131, but for some reason isn't - a mystery):
(Default) ""
Install_Path "c:\steam\steamapps\common\mountblade warband"
version 1124
Hmm, I suppose I could include an additional check for that path for Steam versions. Not really necessary, but additional insurance.
As for the version in the registry not being updated by Steam, that's indeed what was found to be the case previously. However, it is apparently stored in Steam's pseudo-registry files and kept updated there, which the installer script checks.
 
So... I'd like to release another version of this installer script for With Fire and Sword, but I need some assistance. I need somebody who has the Steam release of WFaS to browse to this approximate folder on their system:
C:\Program Files (x86)\Steam\appcache\
Note that the " (x86)" will only be in the path if you're running on a 64-bit version of Windows.
Anyway, find the specific single file "app_48720.vdf", stick it in a zip file, upload it to Mediafire or a similar site, and send me a PM with the link.
 
This is probably a stupid problem that's easily solved, but I'll flag it up anyway.

I've compiled the NSIS script, it "completes successfully", and declares that the executable is in the same directory as my module files -- but no such executable exists. Additionally, the "Test Installer" button does nothing. Running the script a second time seems to start from scratch, with no qualms about overwriting a pre-existing executable.

Is this common?
 
Pug said:
This is probably a stupid problem that's easily solved, but I'll flag it up anyway.

I've compiled the NSIS script, it "completes successfully", and declares that the executable is in the same directory as my module files -- but no such executable exists. Additionally, the "Test Installer" button does nothing. Running the script a second time seems to start from scratch, with no qualms about overwriting a pre-existing executable.

Is this common?
Put the script and the other files in the mod folder. You are probably running it from a separate folder.
 
It's definitely in the mod folder. The script and Installer folder are in Modules\MyMod\. Has this not happened to anyone before...?
 
First I recall hearing of that happening. You might scan through the log it provides in the window to see if there are any problems reported.
 
Janus, could you possibly release a version for Fire and Sword? I tried converting the Warband one but it cannot detect the Steam install, it installs to the mod to Warband in Steam instead of Steams WFAS....

I can get it to install fine for a normal WFAS install under program files however...

Do you still need that VDF of Steam PM'd to you?
 
Hmm, I'd honestly forgotten all about it with everything else I've been busy with.
I have it basically done, with one major problem: version checking doesn't work for Steam copies of the game. For regular releases directly from TaleWorlds, when you install an update it will write the current game version to the Windows registry. For Steam updates, the current game version only seems to be added to the Steam pseudo-registry when you first install it. Later Steam updates don't change that value, and I was unable to find any other way of checking the current game version for Steam releases.

I could just release it with the version checking feature disabled, I suppose.
 
Janus said:
Hmm, I'd honestly forgotten all about it with everything else I've been busy with.
I have it basically done, with one major problem: version checking doesn't work for Steam copies of the game. For regular releases directly from TaleWorlds, when you install an update it will write the current game version to the Windows registry. For Steam updates, the current game version only seems to be added to the Steam pseudo-registry when you first install it. Later Steam updates don't change that value, and I was unable to find any other way of checking the current game version for Steam releases.

I could just release it with the version checking feature disabled, I suppose.

I was actually able to get it to install to Steam installations just fine, I had missed another warband steam path.

It's probably best to just remove the version checking as people should look at what version it supports on the repository....
 
Hello, I'm needing to make a patch for my ROH mod to update it because now I did the other with a few more things and I wanted faser a patch for the people who downloaded version 1.0 can upgrade to 1.5 without downloading the whole mod, I'm having more difficulties in defining the folder with the new files to be exchanged and added to the mod, how do I add a new folder with these files? I'm from Brazil sorry my English.
 
I don't understand the problem. For a patch, you should be able to create an installer exactly the same as you would a regular full release, but only include the updated files. Of course, it won't be able to detect whether the person actually has the older version of the mod installed beforehand, but...
 
Back
Top Bottom