Source Mod Installers

From Valve Developer Community
Revision as of 17:36, 21 October 2005 by Ts2do (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

For this, you need NSIS and HM NIS Edit. Use the following code where:

  • ##MODNAME## is the Mod name.
  • ##MODTEAM## is the Mod's team.
  • ##MODURL## is the Mod's website.
  • ##MODDIR## is the Mod's root directory (i.e. cstrike).
  • ##INSTICO## is the location on the local computer where the icon for the installer executable is.
  • ##GAMEICO## is the location on the local computer where the icon for the desktop icon for the game is.
  • ##FILE1## is the first file you wish to install in the mod folder.
  • ##FILE2## is the second file you wish to install in the mod folder.
  • ##FILEX## is the last file you wish to install in the mod folder.
!define PRODUCT_NAME "##MODNAME##"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "##MODTEAM##"
!define PRODUCT_WEB_SITE "##MODURL##"

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

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "##INSTICO##"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir ""
ShowInstDetails show

Section "Mod" SEC01
  SetOverwrite ifdiff
  SetOutPath "$INSTDIR"
  File "##FILE1##"
  File "##FILE2##"
  File "##FILEX##"

;--Remove this if you do not wish to have a custom desktop icon--
  SetOutPath "$ICONDIR"
  File "GAMEICO"
;--End remove this if you do not wish to have a custom desktop icon--

SectionEnd


Function .onInit
         ReadRegStr $0 HKLM "Software\Valve\Steam" InstallPath
         IfErrors lbl_123 lbl_456

         lbl_456:
                 Goto lbl_done

         lbl_123:
                 ClearErrors
                 StrCpy $0 "$PROGRAMFILES\Valve\Steam"
         lbl_done:
                  StrCpy $INSTDIR "$0\SteamApps\SourceMods\MODDIR"

;--Remove this if you do not wish to have a custom desktop icon--
                  StrCpy $ICONDIR "$0\steam\games"
;--End remove this if you do not wish to have a custom desktop icon--

FunctionEnd

See Also