1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Inno Install Script Tutorial

Discussion in 'Civ4 - Modding Tutorials & Reference' started by Valkrionn, Nov 2, 2009.

  1. Valkrionn

    Valkrionn The Hamster King

    Joined:
    May 23, 2008
    Messages:
    14,450
    Location:
    Crestview FL
    I had someone ask how you make an installer, so I decided I'd write up a little tutorial on the one I'm using for R i f E. This will really just be a description of what each line does... It's a fairly easy to use install script, which I got from Fall Further.

    This script requires Inno, a very flexible install tool. Get it here.

    First, the installer itself:

    Code:
    [Setup]
    AppId={{D67217CB-1166-4023-BB9C-02E986B0B425}
    AppName=Rise from Erebus
    AppVerName=RifE 1.01
    DefaultDirName={reg:HKLM\SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword,INSTALLDIR}\Mods\Rise from Erebus\
    OutputBaseFilename=RifE Setup
    Compression=lzma
    SolidCompression=yes
    DisableProgramGroupPage=yes
    SetupIconFile=D:\Mods\Valkrionn.ico
    
    [Types]
    Name: "full"; Description: "Default installation"
    
    [Components]
    Name: "RifE"; Description: "Rise from Erebus Core Files"; Types: full; Flags: fixed
    Name: "FFPlus"; Description: "Copy Fall Further Plus Files"; Types: full; Flags: fixed
    
    [Languages]
    Name: "english"; MessagesFile: "compiler:Default.isl"
    Name: "french"; MessagesFile: "compiler:Languages\French.isl"
    Name: "german"; MessagesFile: "compiler:Languages\German.isl"
    Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
    
    [Tasks]
    Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags:
    
    [Files]
    
    Source: "{reg:HKLM\SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword,INSTALLDIR}\Mods\Fall Further Plus\*"; DestDir: "{app}"; Flags: external recursesubdirs createallsubdirs comparetimestamp; Components: FFPlus
    Source: "D:\Mods\Patch\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: FFPlus
    ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
    
    [Icons]
    Name: "{userdesktop}\Rise from Erebus"; Filename: "{reg:HKLM\SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword,INSTALLDIR}\Civ4BeyondSword.exe"; Parameters: "mod=\Rise from Erebus"; Tasks: desktopicon; IconFilename: "{app}\Valkrionn.ico"
    
    [Run]
    Filename: "{reg:HKLM\SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword,INSTALLDIR}\Civ4BeyondSword.exe"; Parameters: "mod=\Rise from Erebus"; Description: "{cm:LaunchProgram,Rise from Erebus}"; Flags: nowait postinstall skipifsilent
     
  2. Valkrionn

    Valkrionn The Hamster King

    Joined:
    May 23, 2008
    Messages:
    14,450
    Location:
    Crestview FL
    Now we break it down and explain it.

    [Setup]
    AppId={{D67217CB-1166-4023-BB9C-02E986B0B425}

    //This is the ID for the installer. If it's the same as a previous ID, it will install to the same place as the last one... To change it, select the content in the first bracket (in bold), then go to Tools/Generate GUID.
    AppName=Rise from Erebus
    //Name of the application... Appears below the name of the installer.
    AppVerName=RifE 1.01
    //Version number. Is only displayed when the Installer is running.
    DefaultDirName={reg:HKLM\SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword,INSTALLDIR}\Mods\Rise from Erebus\
    //Install directory. The part in the brackets is used to auto-locate your BtS install path.
    OutputBaseFilename=RifE Setup
    //Name of the installer.
    Compression=lzma
    SolidCompression=yes
    DisableProgramGroupPage=yes

    //Honestly, I never mess with these. :lol:
    SetupIconFile=D:\Mods\Valkrionn.ico
    //If you have an Icon you'd like to use as the program's icon, this line is used to point at the location and grab it in.

    [Types]
    Name: "full"; Description: "Default installation"

    //Type of installation... I don't mess with this.

    [Components]
    Name: "RifE"; Description: "Rise from Erebus Core Files"; Types: full; Flags: fixed
    Name: "FFPlus"; Description: "Copy Fall Further Plus Files"; Types: full; Flags: fixed

    //These are the mod components the user sees when it displays what it is going to install. Setting the flags to Fixed prevents the item from being disabled. Here, it shows that it will copy the base mod's files to a new directory, and then install the Core files for the new mod.
    //NOTE - If you do not need to copy another mod (Important with FfH mods... Not so much with others), delete the "Copy MOD files" line.

    [Languages]
    Name: "english"; MessagesFile: "compiler:Default.isl"
    Name: "french"; MessagesFile: "compiler:Languages\French.isl"
    Name: "german"; MessagesFile: "compiler:Languages\German.isl"
    Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"

    //Languages... Should be easy to add new ones, but I'm honestly not sure. English as a first language, here. :lol:

    [Tasks]
    Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags:

    //This section is used to allow the user to decide if he wants a desktop shortcut. The actual shortcut is created elsewhere.

    [Files]
    Source: "{reg:HKLM\SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword,INSTALLDIR}\Mods\Fall Further Plus\*"; DestDir: "{app}"; Flags: external recursesubdirs createallsubdirs comparetimestamp; Components: FFPlus

    //This line points at the main mod's directory, and all subfolders. You MUST have the \* at the end of the line, or it will not look at subfolders. This is what tells the program to copy the directory to the destination folder, as well.
    //NOTE - Again, if you do not need to copy an existing mod's directory (In the example script, it was actually copied due to a name change between a major release and a patch), delete the above line.
    Source: "D:\Mods\Patch\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: FFPlus
    //This line is used just when the installer compiles. Point it at the files you want included... I keep a seperate directory from the other mods, in order to prevent contamination of the final files with other copies. ;)
    ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
    //System note... Shouldn't have much relevance to a Civ installer.

    [Icons]
    Name: "{userdesktop}\Rise from Erebus"; Filename: "{reg:HKLM\SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword,INSTALLDIR}\Civ4BeyondSword.exe"; Parameters: "mod=\Rise from Erebus"; Tasks: desktopicon; IconFilename: "{app}\Valkrionn.ico"

    //This creates the desktop shortcut. The section in Bold is the name of the shortcut. Itallic is the name of the mod's folder. Underlined and in Bold is the icon you want the shortcut to use.. Make sure to put this in the first folder of your source directory. In the example case, D:\Mods\Patch\Valkrionn.ico. If the installer is simply a patch, and the icon already exists in the mod's folder (NEXT to Assets, not within it), then you don't need to include the icon with the installer... But you likely also don't need the shortcut. ;)

    [Run]
    Filename: "{reg:HKLM\SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword,INSTALLDIR}\Civ4BeyondSword.exe"; Parameters: "mod=\Rise from Erebus"; Description: "{cm:LaunchProgram,Rise from Erebus}"; Flags: nowait postinstall skipifsilent

    //This is used to allow the user to either close the installer and start the mod later, or start playing immediately. What needs to be changed is in bold.... The name of the mod's directory in both cases, I believe.
     
  3. Valkrionn

    Valkrionn The Hamster King

    Joined:
    May 23, 2008
    Messages:
    14,450
    Location:
    Crestview FL
    Reserved for future expansions.
     
  4. lemonjelly

    lemonjelly Modding For Ethne

    Joined:
    Jan 5, 2008
    Messages:
    864
    Location:
    UK
    Wow, very useful, and very well written.

    When I actually get around to releasing something useful, I will use this, thanks =]
     
  5. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    Is it possible to install files to multiple locations? I "need" to install files to both the BtS install folder and customAssets (well, I could just put them all in the BtS install folder, but I'd rather avoid putting the sounds in Assets if I can). Is there a way to do this? An installer for my Star Trek mod has been requested ever since beta 3.
     
  6. Valkrionn

    Valkrionn The Hamster King

    Joined:
    May 23, 2008
    Messages:
    14,450
    Location:
    Crestview FL
    Can you not put the mod in BtS/Mods/Star Trek? Not sure why you need to alter the actual BtS data for it....

    As for splitting the directory, I honestly don't know. Not something that has come up. :lol:

    I'll look into it for you though. ;)
     
  7. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    The issue is with scenarios - each has its own rules, civs, leaders, units, etc. and so each requires its own mod. The art and music assets of the mod are huge, so I have to put them somewhere where the game will load them all the time (none have any effect on a non-Star Trek game).
     
  8. Valkrionn

    Valkrionn The Hamster King

    Joined:
    May 23, 2008
    Messages:
    14,450
    Location:
    Crestview FL
    Well, as far as I can tell you can not set two destinations. What you CAN do, is make two installers... One for the normal path, and one for the art/music.
     

Share This Page