Page 1 of 2 12 LastLast
Results 1 to 20 of 28

Thread: How to make a Professional Quality Installer for your Mod

  1. #1

    Default How to make a Professional Quality Installer for your Mod

    How to make a Professional Quality Installer

    I’ve noticed that many mods either use the Click Team Installer, with that nasty advertisement, or a zipfile with a hideous installation readme of seemingly infinite length. Installation is the user’s first experience with your mod, and you sure don’t want to mess up in the first five minutes!

    Here are the things I expect from a professional quality installer:
    · A small download size.
    · A nice clean looking interface, with nice promo art which will give ma an idea of what to expect from the product.
    · The ability to read the installation instructions in my native language. (Which is English for me… but not for all TW players – you get the point )
    · The ability to choose any installation directory.
    · The ability to download only the components of the mod I want. (Maybe I don’t want to download the 500MB campaign on some obscure nation I don’t know anything about – I’m sure it’s great, but the main campaign will suit me just fine.)
    · The ability to download some popular mini-mods as well.
    · Web installs are always nice, when they can be provided.
    · Icons and shortcuts.
    · No ugly advertisements at the end!
    You can add all of this to your installer without having to pay a penny for commercial software. Here’s how:
    First, go to http://nsis.sourceforge.net/Download and download the latest release of the Nullsoft Scriptable Installer. (2.4.1 at the time of the writing of this article) NSIS is a free program with no strings attached. It is not a limited demo or packaged with spyware/adware, so don’t worry about downloading it. Take a look at all of the fancy features in NSIS’s installer. NSIS’s installer is made with… NSIS! NSIS is aimed at programmers: it compiles code written in the NSIS scripting languages into Windows Installers. This tends to scare away a lot of people. You could program your NSIS installers directly, but it’s a lot of repetitive work to do so, and you’d have to learn NSIS’s scripting language. Instead, we’ll download a program which can generate the code for us.
    http://hmne.sourceforge.net/index.php#Download Download HM NIS Edit. Once again, this program is completely free with no strings attached.
    Open up HM NIS Edit, and choose the New Script from Wizard… option:


    You should see a pop up that looks like this:
    Click to view content: 


    The next pane should look like this:
    Click to view content: 


    Enter your information (or leave it blank, if you prefer) and hit the Next button.

    Now you’ll see this:
    Click to view content: 



    If you have an icon you would like to use for your installation program, resize it to 32x32 pixels and convert it to the .ico format with an image editing program, such as Photoshop, or the GIMP. Then enter your icon in the Setup icon field.
    The Setup file field is the path to which the output installation program will be saved. Change it to whatever you want, but don’t leave it the default, or you will never figure out where your installer was saved. (Especially on Vista, where it may end up being saved to the Virtual Store.)
    Setup lang is the collection of languages which you will allow your users to select when installing. It’s best not to select them all and have your user sort through all of them. Choose the languages your users are most likely to speak. If you are making a mod about Hungary for example, you might want to add Hungarian as a language here. If you are making a general mod which is likely to be used by a large number of people, choose the most widely spoken few languages: English, French, Spanish, and German, should cover about 90% of the people who will use your mod.
    Leave the GUI option set to Modern for now. The other two options you should have, Default and Tiny, are pretty ugly, IMO. Later on, you can download more themes from nsis.sourgeforge.net, or even make your own themes.
    Compress is the compression method which your installer will use to archive the install data. LZMA is a newer compression method. It’s a nice compromise between speed and size. I’d recommend that you choose LZMA, but your choice compression method won’t have an enormous impact on the performance of your installer.
    Okay, that was a lot. Now hit the Next button.

    This is what you will see:
    Click to view content: 



    Application default directory Is the default folder to which the installer will install your mod. Set it to $PROGRAMFILES\SEGA\Medieval II Total War\ as I did. Most of your users will probably have their M2TW installed here. But not all of them, so by no means should you uncheck the Allow user to change the application directory checkbox.
    Hopefully you had the forethought to release your mod under a license. If you didn’t, it is probably a good idea to get one. I would recommend releasing your mod under an open source license (since you will be releasing your source in the download anyway). If you want to go open source, try using the MIT, Apache Server, BSD, or GPL licenses. Once you have your license, save it into a plain text file (.txt), or rich text file (.rtf) and select the file under the License file option.
    The next option doesn’t make much of a difference: it just specifies how your user should agree to the license.

    Here comes the fun part:
    Click to view content: 


    This is where you specify the files to be included in the installation. Installation files in Nullsoft are divided into sections. Think of a section as something which could be an individual download. Remember how I said you could let the user choose what they want to download earlier? This is how. First off, check the Allow user to select the components to install box. Next, delete the example files shown in the box to the right. Click on each entry, and then click the delete button above. MainSection is mandatory in every NSIS installation. This is the part of the installation that users must download for the installation to work. In M2TW speak, this equates to the imperial/default campaign.

    To set the files for the MainSection, Press the Add directory tree button over the list box on the right. This dialog will pop up:
    Click to view content: 



    In the Select Directory field, enter your mod folder. (Before doing so, remove any features you want to keep optional – cut out the files and paste them onto your desktop).
    Leave Destination directory to $INSTDIR, or things will be seriously messed up. I don’t think anyone wants your mod in their System32 folder…
    Set If file exists to Always overwrite. This will make your installer catch and report errors rather than try to continue if a file fails to install.
    Hit the OK button.

    Now you should be back to the wizard. Under Description, enter “MyModName Main Campaign”, or something similar.

    If you don’t want any optional features in your installer, you are done – skip to the next step. Otherwise, let’s continue:

    If you wanted to have optional features, hopefully you cut out the features that were optional and pasted the files onto your desktop. If you didn’t, go back now and do it! And you’ll have to reenter your mod’s directory tree into the MainSection. Now, take the files you put on your desktop, and split them up into the various features, such as campaign 1, campaign 2, extra battle maps, and so on. Put all of these files back into proper M2TW directory trees. You should have one mod folder on your desktop for each feature. In the wizard, create a new section and give it a name. Set the files for the section to the corresponding mod folder on your desktop. Add a description for the section. Rinse and repeat.

    The next step is self explanatory. Here are my recommended settings:
    Click to view content: 
    Up top, you should have the name of your mod. I'd recommend that you check all three of the checkboxes below that. The most important part of this page is the setup. Normally, we would have specified an executable as part of our MainSection, and the wizard would have automatically generated shortcuts for us. Our main executable is medieval2.exe for a M2TW mod, and kingdoms.exe for a Kingdoms mod. Hoever, it is illegal to redistribute these files, so we cannot include them as part of our main section. You'll have to add the shortcuts in manually. Since you don't have an executable to link to, you should make a batch (.bat) file and link to that. Fill in the two entries as I did above.
    Next pane:
    Click to view content: 


    Obviously, if you are using kingdoms, $INSTDIR\medieval2.exe should be $INSTDIR\kingdoms.exe. If you are using a .bat file, set Program to the bat file instead. Otherwise, set Params to @ and your config file. If you have a readme (once again, you should) set Readme to $INSTDIR\myreadmefile.txt. (The readme file should have also been included in your MainSection. If it wasn’t, go back and fix it…)
    Click to view content: 


    Don’t forget your uninstaller! (And don’t leave it out on purpose…) It is best to simply leave the first two fields alone. You may want to specify an icon for your uninstaller. (Probably the same one as you used for your installer.)
    Click to view content: 


    Check the first two boxes and hit Finish. You will be prompted to save the script output. Enter whatever name you like.

    You should see something like this now:
    Click to view content: 


    This is the code that was generated by HM NIS Edit. We’ve only scratched the surface of NSIS, and there is a lot more which can be done by scripting the code manually (actually, you can do pretty much anything.) If there is a demand for a tutorial on more advanced installer techniques, I may write a follow up to this tutorial. But I digress. This tutorial is about the basics. I promised no coding, so what now? Why not hit the compile button?



    Now just open up Windows Explorer and go to the folder where you saved your .exe. There’s your installer!


    Last edited by Azim; December 02, 2008 at 08:57 PM.

    Dominion of the Sword, a Medieval II: Total War Supermod
    Under the patronage of Archaon. Proud member of the House of Siblesz
    My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!

  2. #2
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: How to make a Professional Quality Installer for your Mod

    Nice job Azim. I think this should be in the Tutorials section though, with a sticky.

  3. #3

    Default Re: How to make a Professional Quality Installer for your Mod

    Oops, didn't look at the forum name.

    Dominion of the Sword, a Medieval II: Total War Supermod
    Under the patronage of Archaon. Proud member of the House of Siblesz
    My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!

  4. #4

    Default Re: How to make a Professional Quality Installer for your Mod

    Wicked!!!
    Contribuitor IBIICB-WOTN-Modeler-Scripter


  5. #5
    y2day's Avatar TWC STORE NOW OPEN!
    Content Emeritus spy of the council

    Join Date
    Oct 2007
    Location
    under your bed
    Posts
    9,248

    Default Re: How to make a Professional Quality Installer for your Mod

    Very nice, I've seen this program before when searching for installers. I wil have to give it a try. Very good instructions.




    TWC Graphics Workshop Art Competition!!!
    MEMBER OF THE IMPERIAL HOUSE OF HADER

  6. #6
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: How to make a Professional Quality Installer for your Mod

    Obviously, if you are using kingdoms, $INSTDIR\medieval2.exe should be $INSTDIR\kingdoms.exe. If you are using a .bat file, set Program to the bat file instead. Otherwise, set Params to @ and your config file. If you have a readme (once again, you should) set Readme to $INSTDIR\myreadmefile.txt. (The readme file should have also been included in your MainSection. If it wasn’t, go back and fix it…)
    I have a problem creating a desktop shortcut as well as an automatic start of the program.
    My bat and cfg files are in this directory: mods\modname but even manually linking like below doesn't work.
    ; Finish page
    !define MUI_FINISHPAGE_RUN "$INSTDIR\mods\modname\Executable.bat"
    Any help?










  7. #7

    Default Re: How to make a Professional Quality Installer for your Mod

    Did you include Executable.bat in the MainSection?

    Post your script and I'll take a look at it.

    Dominion of the Sword, a Medieval II: Total War Supermod
    Under the patronage of Archaon. Proud member of the House of Siblesz
    My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!

  8. #8
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: How to make a Professional Quality Installer for your Mod

    Underneath the script. M2TW resides in c:\games\m2tw. Entry in red is manually as I am failing to find the correct instance in the wizard. Deleting the row doesn't work - recreated automatically.
    Installation goes into the correct folder. Executable.bat is the normal batch file to start a mod. Configuration.cfg is the regular cfg file for a mod. Both files are working correctly.
    A note: the uninstaller doesn't remove the directories or the startmenu - files in directories only.


    Spoiler Alert, click show to read: 
    ; Script generated by the HM NIS Edit Script Wizard.

    ; HM NIS Edit Wizard helper defines
    !define PRODUCT_NAME "Latinokratia"
    !define PRODUCT_VERSION "0.004"
    !define PRODUCT_PUBLISHER "gigantus"
    !define PRODUCT_WEB_SITE "http://www.twcenter.net/forums/showthread.php?p=4086824#post4086824"
    !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
    !define PRODUCT_UNINST_ROOT_KEY "HKLM"
    !define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"

    SetCompressor lzma

    ; MUI 1.67 compatible ------
    !include "MUI.nsh"

    ; MUI Settings
    !define MUI_ABORTWARNING
    !define MUI_ICON "..\..\..\Games\M2TW\mods\Latinokratia\Icon.ico"
    !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"

    ; Welcome page
    !insertmacro MUI_PAGE_WELCOME
    ; License page
    !insertmacro MUI_PAGE_LICENSE "..\..\..\Games\M2TW\mods\Latinokratia\License.txt"
    ; Components page
    !insertmacro MUI_PAGE_COMPONENTS
    ; Directory page
    !insertmacro MUI_PAGE_DIRECTORY
    ; Start menu page
    var ICONS_GROUP
    !define MUI_STARTMENUPAGE_NODISABLE
    !define MUI_STARTMENUPAGE_DEFAULTFOLDER "Latinokratia"
    !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
    !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
    !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
    !insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
    ; Instfiles page
    !insertmacro MUI_PAGE_INSTFILES
    ; Finish page
    !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\ReadMe.txt"
    !insertmacro MUI_PAGE_FINISH

    ; Uninstaller pages
    !insertmacro MUI_UNPAGE_INSTFILES

    ; Language files
    !insertmacro MUI_LANGUAGE "English"

    ; Reserve files
    !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

    ; MUI end ------

    Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
    OutFile "Latinokratia.exe"
    InstallDir "$PROGRAMFILES\Sega\Medieval2\mods\Latinokratia"
    ShowInstDetails show
    ShowUnInstDetails show

    Section "MainSection" SEC01
    SetOutPath "$INSTDIR"
    SetOverwrite try
    File "..\..\..\Games\M2TW\mods\Latinokratia\Configuration.cfg"
    File "..\..\..\Games\M2TW\mods\Latinokratia\Copy Sound.bat"
    SetOutPath "$INSTDIR\data"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\descr_sm_factions.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\descr_sm_factions_original.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\export_descr_buildings.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\export_descr_unit.txt"
    SetOutPath "$INSTDIR\data\sounds"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\sounds\events.dat"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\sounds\events.idx"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\sounds\Music.dat"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\sounds\Music.idx"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\sounds\SFX.dat"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\sounds\SFX.idx"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\sounds\Voice.dat"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\sounds\Voice.idx"
    SetOutPath "$INSTDIR\data\text"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\text\expanded.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\text\expanded.txt.strings.bin"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\text\imperial_campaign_regions_and_settlement_names.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\text\imperial_campaign_regions_and_settlement_names.txt.strings.bin"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\text\shared.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\text\shared.txt.strings.bin"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\text\strat.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\text\strat.txt.strings.bin"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\text\tooltips.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\text\tooltips.txt.strings.bin"
    SetOutPath "$INSTDIR\data\world\maps\base"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\descr_disasters.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\descr_regions.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\descr_sounds_music_types.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\descr_terrain.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\Executable - Shortcut.lnk"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\M2TW.system.log - Shortcut.lnk"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\map.rwm"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\map_climates.tga"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\map_features.tga"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\map_fog.tga"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\map_ground_types.tga"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\map_ground_types_small.tga"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\map_heights.tga"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\map_heights_small.tga"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\map_regions.tga"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\map_regions_big.tga"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\map_roughness.tga"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\map_trade_routes.tga"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\Thumbs.db"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\base\water_surface.tga"
    SetOutPath "$INSTDIR\data\world\maps\campaign\imperial_campaign"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\campaign\imperial_campaign\campaign_script.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\campaign\imperial_campaign\descr_mercenaries.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\campaign\imperial_campaign\descr_regions_and_settlement_name_lookup.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\campaign\imperial_campaign\descr_strat.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\campaign\imperial_campaign\radar_map1.tga"
    File "..\..\..\Games\M2TW\mods\Latinokratia\data\world\maps\campaign\imperial_campaign\radar_map2.tga"
    SetOutPath "$INSTDIR"
    File "..\..\..\Games\M2TW\mods\Latinokratia\Executable.bat"
    File "..\..\..\Games\M2TW\mods\Latinokratia\Icon.ico"
    File "..\..\..\Games\M2TW\mods\Latinokratia\L - Building Trees.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\L - Cultures.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\L - Infrastructure.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\L - Layout Map.gif"
    File "..\..\..\Games\M2TW\mods\Latinokratia\L - Rebels.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\L - Region Details.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\L - Region Names.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\License.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\ReadMe.txt"
    File "..\..\..\Games\M2TW\mods\Latinokratia\Thumbs.db"

    ; Shortcuts
    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
    CreateDirectory "Shortcut"
    CreateShortCut "$DESKTOP.lnk" "$INSTDIR\Executable.bat"
    !insertmacro MUI_STARTMENU_WRITE_END
    SectionEnd

    Section -AdditionalIcons
    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
    WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
    CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
    CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
    CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
    !insertmacro MUI_STARTMENU_WRITE_END
    SectionEnd

    Section -Post
    WriteUninstaller "$INSTDIR\uninst.exe"
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
    SectionEnd

    ; Section descriptions
    !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} ""
    !insertmacro MUI_FUNCTION_DESCRIPTION_END


    Function un.onUninstSuccess
    HideWindow
    MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
    FunctionEnd

    Function un.onInit
    MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
    Abort
    FunctionEnd

    Section Uninstall
    !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
    Delete "$INSTDIR\${PRODUCT_NAME}.url"
    Delete "$INSTDIR\uninst.exe"
    Delete "$INSTDIR\Thumbs.db"
    Delete "$INSTDIR\ReadMe.txt"
    Delete "$INSTDIR\License.txt"
    Delete "$INSTDIR\L - Region Names.txt"
    Delete "$INSTDIR\L - Region Details.txt"
    Delete "$INSTDIR\L - Rebels.txt"
    Delete "$INSTDIR\L - Layout Map.gif"
    Delete "$INSTDIR\L - Infrastructure.txt"
    Delete "$INSTDIR\L - Cultures.txt"
    Delete "$INSTDIR\L - Building Trees.txt"
    Delete "$INSTDIR\Icon.ico"
    Delete "$INSTDIR\Executable.bat"
    Delete "$INSTDIR\data\world\maps\campaign\imperial_campaign\radar_map2.tga"
    Delete "$INSTDIR\data\world\maps\campaign\imperial_campaign\radar_map1.tga"
    Delete "$INSTDIR\data\world\maps\campaign\imperial_campaign\descr_strat.txt"
    Delete "$INSTDIR\data\world\maps\campaign\imperial_campaign\descr_regions_and_settlement_name_lookup.txt"
    Delete "$INSTDIR\data\world\maps\campaign\imperial_campaign\descr_mercenaries.txt"
    Delete "$INSTDIR\data\world\maps\campaign\imperial_campaign\campaign_script.txt"
    Delete "$INSTDIR\data\world\maps\base\water_surface.tga"
    Delete "$INSTDIR\data\world\maps\base\Thumbs.db"
    Delete "$INSTDIR\data\world\maps\base\map_trade_routes.tga"
    Delete "$INSTDIR\data\world\maps\base\map_roughness.tga"
    Delete "$INSTDIR\data\world\maps\base\map_regions_big.tga"
    Delete "$INSTDIR\data\world\maps\base\map_regions.tga"
    Delete "$INSTDIR\data\world\maps\base\map_heights_small.tga"
    Delete "$INSTDIR\data\world\maps\base\map_heights.tga"
    Delete "$INSTDIR\data\world\maps\base\map_ground_types_small.tga"
    Delete "$INSTDIR\data\world\maps\base\map_ground_types.tga"
    Delete "$INSTDIR\data\world\maps\base\map_fog.tga"
    Delete "$INSTDIR\data\world\maps\base\map_features.tga"
    Delete "$INSTDIR\data\world\maps\base\map_climates.tga"
    Delete "$INSTDIR\data\world\maps\base\map.rwm"
    Delete "$INSTDIR\data\world\maps\base\M2TW.system.log - Shortcut.lnk"
    Delete "$INSTDIR\data\world\maps\base\Executable - Shortcut.lnk"
    Delete "$INSTDIR\data\world\maps\base\descr_terrain.txt"
    Delete "$INSTDIR\data\world\maps\base\descr_sounds_music_types.txt"
    Delete "$INSTDIR\data\world\maps\base\descr_regions.txt"
    Delete "$INSTDIR\data\world\maps\base\descr_disasters.txt"
    Delete "$INSTDIR\data\text\tooltips.txt.strings.bin"
    Delete "$INSTDIR\data\text\tooltips.txt"
    Delete "$INSTDIR\data\text\strat.txt.strings.bin"
    Delete "$INSTDIR\data\text\strat.txt"
    Delete "$INSTDIR\data\text\shared.txt.strings.bin"
    Delete "$INSTDIR\data\text\shared.txt"
    Delete "$INSTDIR\data\text\imperial_campaign_regions_and_settlement_names.txt.strings.bin"
    Delete "$INSTDIR\data\text\imperial_campaign_regions_and_settlement_names.txt"
    Delete "$INSTDIR\data\text\expanded.txt.strings.bin"
    Delete "$INSTDIR\data\text\expanded.txt"
    Delete "$INSTDIR\data\sounds\Voice.idx"

    Delete "$INSTDIR\data\sounds\Voice.dat"
    Delete "$INSTDIR\data\sounds\SFX.idx"
    Delete "$INSTDIR\data\sounds\SFX.dat"
    Delete "$INSTDIR\data\sounds\Music.idx"
    Delete "$INSTDIR\data\sounds\Music.dat"
    Delete "$INSTDIR\data\sounds\events.idx"
    Delete "$INSTDIR\data\sounds\events.dat"
    Delete "$INSTDIR\data\export_descr_unit.txt"
    Delete "$INSTDIR\data\export_descr_buildings.txt"
    Delete "$INSTDIR\data\descr_sm_factions_original.txt"
    Delete "$INSTDIR\data\descr_sm_factions.txt"
    Delete "$INSTDIR\Copy Sound.bat"
    Delete "$INSTDIR\Configuration.cfg"

    Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
    Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
    Delete "$DESKTOP.lnk"

    RMDir "$SMPROGRAMS\$ICONS_GROUP"
    RMDir "$INSTDIR\data\world\maps\campaign\imperial_campaign"
    RMDir "$INSTDIR\data\world\maps\base"
    RMDir "$INSTDIR\data\text"
    RMDir "$INSTDIR\data\sounds"
    RMDir "$INSTDIR\data"
    RMDir "$INSTDIR"
    RMDir ""

    DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
    SetAutoClose true
    SectionEnd










  9. #9

    Default Re: How to make a Professional Quality Installer for your Mod

    So the only manual modification you made is the line in red?

    Dominion of the Sword, a Medieval II: Total War Supermod
    Under the patronage of Archaon. Proud member of the House of Siblesz
    My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!

  10. #10
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: How to make a Professional Quality Installer for your Mod

    That is correct. The entry in RED, the rest of the line was created automatically and created an error when compiling. Hence I did the manual entry.










  11. #11

    Default Re: How to make a Professional Quality Installer for your Mod

    Great tutorial
    Bravo Azim!

  12. #12

    Default Re: How to make a Professional Quality Installer for your Mod

    Gigantus, CreateDirectory "Shortcut" will result in unpredictable behavior. You have to specifiy absolute paths; relavtive paths will not work. You said that the original code generated by HM NS Edit also didn't work, right? What didi it say originally? Do you remember?

    Varangian_Guard, thanks.

    Dominion of the Sword, a Medieval II: Total War Supermod
    Under the patronage of Archaon. Proud member of the House of Siblesz
    My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!

  13. #13
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: How to make a Professional Quality Installer for your Mod

    If there is only the default entry ( CreateDirectory "") which is created automatically, even if I delete it again, I get the following error:

    Code:
    Usage: CreateDirectory directory_name
    Error in script "C:\Users\Thomas\Desktop\Latino.nsi" on line 135 -- aborting creation process










  14. #14

    Default Re: How to make a Professional Quality Installer for your Mod

    Is that the error from when the line says CreateDirectory "" or when you delete the entire line? Post what it says when you delete the entire line.

    Dominion of the Sword, a Medieval II: Total War Supermod
    Under the patronage of Archaon. Proud member of the House of Siblesz
    My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!

  15. #15
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: How to make a Professional Quality Installer for your Mod

    It doesn't give an error, it simply recreates the line before compiling.










  16. #16

    Default Re: How to make a Professional Quality Installer for your Mod

    So what happens when you compile with CreateDirectory ""? Maybe it is supposed to say this? :hmmm:I'll generate a test script and see what I get.

    Dominion of the Sword, a Medieval II: Total War Supermod
    Under the patronage of Archaon. Proud member of the House of Siblesz
    My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!

  17. #17

    Default Re: How to make a Professional Quality Installer for your Mod

    Nice tutorial. +rep


  18. #18
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: How to make a Professional Quality Installer for your Mod

    Just something of note that I found inadvertently with this. If you have a file name that has unrecognized characters in it, the compiler will abort. One of the mini-mods I was using had russian characters in 3 of the file names, so I had to remove them or rename them for it to work.

    Another thing, and I may be wrong about this, is you probably want your mod folder in another blank folder somewhere, and then to select that blank folder when selecting a main directory tree. Reason being, it seems the install path if you were to just click your mod folder, would be bound to overwrite base M2 files since it treats the top folder as a holder.

    A question I had about this, is whether there is an install priority of like-named files, or if such files will cause errors? That is to say, if we wanted to include a sub-mod that replaces loading screens or something, but the main folder has the same files in the same directory, do the optional overwrite the base? I'm guessing not. In which case, anyone have a nice example of a batch file that say, looks to see if loading_screen.tga is in /submods/ and if it is, replaces the old one with it. I'm sure I can figure it out pretty easily, but if someone has done something similar would save some time.

  19. #19

    Default Re: How to make a Professional Quality Installer for your Mod

    I didn't know about that file name problem. I wonder if it's possible to set the encoding of the nis file? It's only a plain text file, so it may be possible to substitute an 8-bit ASCII format with a UTF-8 format. That might solve your problem. Normally, when windows encounters a file with special characters in the name, it creates two copies of the file name: a display name and an internal name. The internal name follows the 8.3 format and contains only ascii characters. You could enter the short names into the nis file to avoid these problems. See this page for information on how to calculate the internal file name.

    Of course, generally, it is good only to use standard characters in file names to avoid problems like these.

    I'm not completely sure what you mean about putting your mod folder in a blank parent folder. Could you explain that a bit more? From my experience, you should be fine as long as you set the root folder to be the mod folder.

    As for overwriting priorities:

    Quote Originally Posted by Azim View Post
    To set the files for the MainSection, Press the Add directory tree button over the list box on the right. This dialog will pop up:


    Quote Originally Posted by Azim View Post
    Set If file exists to Always overwrite. This will make your installer catch and report errors rather than try to continue if a file fails to install.
    You can modify this attribute on a per file basis. There are four options for this field: Overwrite if newer, Always overwrite, Never overwrite, and Try to overwrite.

    You might want to try Never overwrite and Overwrite if newer.
    Last edited by Azim; April 12, 2009 at 01:31 PM.

    Dominion of the Sword, a Medieval II: Total War Supermod
    Under the patronage of Archaon. Proud member of the House of Siblesz
    My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!

  20. #20

    Default Re: How to make a Professional Quality Installer for your Mod

    Oh I feel like such an idiot I opened up the first spoiler alert then looked at the TV and forgot what I was doing so I look back and start clicking on the next button repeatedly until I realised what was going on Well anyways nice quick and simple tuturial this will really help me when I get my mod done! I gove you 5 stars

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •