Source Mod Installers: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 17: Line 17:
!define PRODUCT_WEB_SITE "##MODURL##"
!define PRODUCT_WEB_SITE "##MODURL##"


;Remove this if you do not wish to have a custom desktop icon:
;Uncomment this if you do not wish to have a custom desktop icon:
!define DESKTOP_ICON
;!define NO_DESKTOP_ICON


; MUI 1.67 compatible ------
; MUI 1.67 compatible ------
Line 51: Line 51:
   File "##FILEX##"
   File "##FILEX##"


!ifdef DESKTOP_ICON
!ifndef NO_DESKTOP_ICON
   SetOutPath "$1"
   SetOutPath "$2"
   File "DESKICO"
   File "DESKICO"
!endif
!endif
Line 61: Line 61:
Function .onInit
Function .onInit
         ReadRegStr $0 HKLM "Software\Valve\Steam" InstallPath
         ReadRegStr $0 HKLM "Software\Valve\Steam" InstallPath
        ReadRegStr $1 HKCU "Software\Valve\Steam" SourceModInstallPath
         IfErrors lbl_123 lbl_456
         IfErrors lbl_123 lbl_456


         lbl_456:
         lbl_456:
                 Goto lbl_done
                 Goto lbl_done
         lbl_123:
         lbl_123:
                 ClearErrors
                 ClearErrors
                 StrCpy $0 "$PROGRAMFILES\Valve\Steam"
                 StrCpy $0 "$PROGRAMFILES\Valve\Steam"
                Goto lbl_end
         lbl_done:
         lbl_done:
                  StrCpy $INSTDIR "$0\SteamApps\SourceMods\MODDIR"
                StrCpy $INSTDIR "$1\##MODDIR##"
!ifdef DESKTOP_ICON
                Goto lbl_end
                  StrCpy $1 "$0\steam\games"
        lbl_end:
!ifndef NO_DESKTOP_ICON
                StrCpy $2 "$0\steam\games"
!endif
!endif
FunctionEnd</pre>
FunctionEnd</pre>
==See Also==
==See Also==
* [[Steam 3rd Party Mod Support]]
* [[Steam 3rd Party Mod Support]]
[[Category:Tutorials]]
[[Category:Tutorials]]

Revision as of 18:06, 21 October 2005

For this, you need NSIS and HM NIS Edit.

Use the following code where:

  • ##MODNAME## is the Mod name.
  • ##MODVERSION## is the installer's release version.
  • ##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.
  • ##DESKICO## 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 "##MODVERSION##"
!define PRODUCT_PUBLISHER "##MODTEAM##"
!define PRODUCT_WEB_SITE "##MODURL##"

;Uncomment this if you do not wish to have a custom desktop icon:
;!define NO_DESKTOP_ICON

; 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##"

!ifndef NO_DESKTOP_ICON
  SetOutPath "$2"
  File "DESKICO"
!endif

SectionEnd


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

         lbl_456:
                 Goto lbl_done
         lbl_123:
                 ClearErrors
                 StrCpy $0 "$PROGRAMFILES\Valve\Steam"
                 Goto lbl_end
         lbl_done:
                 StrCpy $INSTDIR "$1\##MODDIR##"
                 Goto lbl_end
         lbl_end:
!ifndef NO_DESKTOP_ICON
                 StrCpy $2 "$0\steam\games"
!endif
FunctionEnd

See Also