BtS Mod Install Script

Yeah, you can do all of those things. The optional add on is something I actually removed from the template script I used from Jean Elcard, so it should be trivial to set it up, as the script is already written with optional install options in mind (just none of them exist in current form). The icon one is something I will add to this script eventually (and also make it so that the shortcut will use that icon). I'm not exactly sure how to do it, it's in the tutorials guide though. If you do add this effect, please share the improved script, and I'll update this one so that the script does it, basically just add a third script that uses an icon to the download database.

Icon example shortcut
The above link also takes you to the main reference link for NSIS scripting, so you can browse that to figure out how to do the the other things.

Again though, if you do add these functions please share them, in a way that is easily understandable, so I can update these for other modmakers (and use the icon making one myself, as it's one of the tools I plan to add to my script anyway).
 
Okay, I've been messing around with it today, and have added the following features:
  • Optional start menu shortcut that will install in the same folder as the BtS ones (but if you've moved it from its original location, it doesn't work - could definitely work better)
  • Optional quick launch shortcut
  • Use your own icon simply by putting it inside your mod folder with the same name as your mod (looks poor if none included - is there a way to avoid this?)
  • The core of the mod is now always installed (cannot be turned off)
  • "Short name" variable that is used as the main title in case the mod name is too long (defined as the mod name by default)
  • Extra version for use if mod has multiple parts to it (example also included)
    This does require your mod to be split into two folders in the correct directory, which may look odd if you're doing it inside the Mods folder, as it won't work if you try to play it as a mod
I think that's all. My version is a little more complicated, but so long as you don't mess with anything, there shouldn't be a problem. I've included my sample script for the Native America Expanded mod so that you can see how to edit it if necessary.

Download here

I'm pretty pleased with how it's looking, although there are always ways to improve it
 
Phungus, do you have any comments? This is really your script, so I'm waiting to see what you think before making more additions. I already have a new edit in the works which moves the shortcut creation to different screens, and allows you to pick your own start menu folder.
 
Hmmm, I need an icon for Bronze Steam and Tears to test it... Sorry I haven't responded earlier, I've been aware of your improvements to the script for some time, just haven't had a real means to test it, and was thus procrastinating. I'll work in using this later today, or early tomarrow. Also don't hold back a new and superior version just because I'm procrastinating.
 
Has anyone tried out the updated version? Any comments?

I just tried it out and I like it. I needed to change some minor things, but it works like charm. The only issue might be that it generates a bit bigger file than a mere 7zip. But it's sure nice!
Thank you!:goodjob:
 
Finally getting around to using the improved version. Seems to work OK, it's a little overly complex I think with all the variables at the begging of the script, otherwise seems good.

One thing though, How can I get it so that the installer uses the icon for the shortcut and stuff for the installer itself? The installer still uses the NSIS icon, but I know it's possible to have it use your shortcut icon for the main installer, and would probably look best like that.
 
Updated OP. New scripts included. Also all the scripts have been cleaned up and added some comments to the scripts to make them very user friendly. You should be able to use these scripts even if you have no knowledge of programming, the comments should direct you on what to do, and there are only a couple entries that need to be changed so that the script will apply to a specific mod. The optional add on script is a little more complex though, you might need a rudimentary knowledge of code, or at least have good common sense to use it.

Another note, cleaned up some of the code of the script, and added delay function on uninstaller. The uninstaller now must finish before proceeding to the installation if the full install is being updated to a new version.
 
Some technical details. The scripts all work well, but I have a nitpicky thing I'm trying to solve. NikNaks or anyone else who's good with scripting language:
I haven't been able to get the Start Menu shortcut to work unless I don't put it in a path. If I just use
Code:
"$SMPROGRAMS\${NAME}.lnk"
It works fine, however if when I try to get it to post the shortcut in a group (I'd like it to be with the main Civ4 launch icon), it doesn't work. I've tried everything, anything like this just fails:
Code:
"$SMPROGRAMS\AnyGroupName\${NAME}.lnk"
I can't figure it out. This is why I removed that information from your scripting NikNaks, the start menu shortcut never apeared, so I had to cut it back to the bear minimum path to make it show up. Is this a problem with my computer or something? I've tried updating my NSIS installer to the most recent version, and looked around on the internet, but according to all the scripting examples, I'm defining the path correctly, it's just not working :dunno:
 
What I'm saying is:

Code:
  Section "Start Menu Shortcut" Section4
    CreateShortCut "$SMPROGRAMS\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword\${NAME}.lnk" "$INSTDIR1\Civ4BeyondSword.exe" "mod=\${MOD_LOC}" "${MYCLSDIR}\${NAME}.ico" 0
  SectionEnd
Doesn't work for me, the shortcut never gets created in the start menu.

However:
Code:
  Section "Start Menu Shortcut" Section4
    CreateShortCut "$SMPROGRAMS\${NAME}.lnk" "$INSTDIR1\Civ4BeyondSword.exe" "mod=\${MOD_LOC}" "${MYCLSDIR}\${NAME}.ico" 0
  SectionEnd
Works. It's just the shortcut gets printed on the base program menu, but I'd like it to be grouped with the Beyond the Sword shortcut. This is why in my new uploaded scripts based off of yours, I've shortened the start menu path to the above. I don't understand why putting it in a path doesn't work, but if I put it off the main path with anything it fails, for instance this fails:
Code:
  Section "Start Menu Shortcut" Section4
    CreateShortCut "$SMPROGRAMS\Games\${NAME}.lnk" "$INSTDIR1\Civ4BeyondSword.exe" "mod=\${MOD_LOC}" "${MYCLSDIR}\${NAME}.ico" 0
  SectionEnd
As does this:
Code:
  Section "Start Menu Shortcut" Section4
    CreateShortCut "$SMPROGRAMS\Test\${NAME}.lnk" "$INSTDIR1\Civ4BeyondSword.exe" "mod=\${MOD_LOC}" "${MYCLSDIR}\${NAME}.ico" 0
  SectionEnd
 
Phungus, remember the problem I had calling up WolfRev and BST? Well do you think if I dl someone else's mod with this program that we may find out if it is your mod that is not working for my computer or if this program is not working for my computer?
I can't imagine what's wrong with my PC that I am the only one who is getting this error. It's not fair!:cringe:
 
It's impossible for this script to mess up, unless you intentionally hacked your own computer and messed with the Registry key for Civ4.
 
Hi,
currently if the installer cannot find the path/Civ is not installed, it won't allow to install anyway even if you enter the path manually (the <next> is greyed out )
How can this be corrected?
 
Yes, if it can't locate the Civ4BeyondtheSword.exe in the parent folder, it will not install. This is by design, as if the auto detection fails, it forces the user to locate the correct path to install to. It wol't install because if it were to install to a directory mods, in which the parent directory didn't have the BeyondtheSword.exe the mod would fail to work.

If you do want to remove this, I'm pretty sure it's controlled here:

Code:
  Function .onVerifyInstDir
    StrCmp $CurrentPage "DirectoryPage1" check1 valid
    check1:
      IfFileExists "$INSTDIR1\Civ4BeyondSword.exe" valid invalid
    valid:
      Return
    invalid:
      Abort
  FunctionEnd

Removing this block of code should allow it to install wherever it pleases. If doing that doesn't work, let me know and I'll look, through the script again, and see if there is any other part of code that is part of the verify function.
 
Top Bottom