Source Mod Installers: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 7: Line 7:
* <code>##MODDIR##</code> is the Mod's root directory (i.e. <code>cstrike</code>).
* <code>##MODDIR##</code> is the Mod's root directory (i.e. <code>cstrike</code>).
* <code>##INSTICO##</code> is the location on the local computer where the icon for the installer executable is.
* <code>##INSTICO##</code> is the location on the local computer where the icon for the installer executable is.
* <code>##GAMEICO##</code> is the location on the local computer where the icon for the desktop icon for the game is.
* <code>##DESKICO##</code> is the location on the local computer where the icon for the desktop icon for the game is.
* <code>##FILE1##</code> is the first file you wish to install in the mod folder.
* <code>##FILE1##</code> is the first file you wish to install in the mod folder.
* <code>##FILE2##</code> is the second file you wish to install in the mod folder.
* <code>##FILE2##</code> is the second file you wish to install in the mod folder.
Line 15: Line 15:
!define PRODUCT_PUBLISHER "##MODTEAM##"
!define PRODUCT_PUBLISHER "##MODTEAM##"
!define PRODUCT_WEB_SITE "##MODURL##"
!define PRODUCT_WEB_SITE "##MODURL##"
;Remove this if you do not wish to have a custom desktop icon:
!define DESKTOP_ICON


; MUI 1.67 compatible ------
; MUI 1.67 compatible ------
Line 47: Line 50:
   File "##FILEX##"
   File "##FILEX##"


;--Remove this if you do not wish to have a custom desktop icon--
!ifdef DESKTOP_ICON
   SetOutPath "$1"
   SetOutPath "$1"
   File "GAMEICO"
   File "DESKICO"
;--End remove this if you do not wish to have a custom desktop icon--
!endif


SectionEnd
SectionEnd
Line 67: Line 70:
         lbl_done:
         lbl_done:
                   StrCpy $INSTDIR "$0\SteamApps\SourceMods\MODDIR"
                   StrCpy $INSTDIR "$0\SteamApps\SourceMods\MODDIR"
 
!ifdef DESKTOP_ICON
;--Remove this if you do not wish to have a custom desktop icon--
                   StrCpy $1 "$0\steam\games"
                   StrCpy $1 "$0\steam\games"
;--End remove this if you do not wish to have a custom desktop icon--
!endif


FunctionEnd</pre>
FunctionEnd</pre>

Revision as of 17:59, 21 October 2005

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.
  • ##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 "1.0"
!define PRODUCT_PUBLISHER "##MODTEAM##"
!define PRODUCT_WEB_SITE "##MODURL##"

;Remove this if you do not wish to have a custom desktop icon:
!define 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##"

!ifdef DESKTOP_ICON
  SetOutPath "$1"
  File "DESKICO"
!endif

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"
!ifdef DESKTOP_ICON
                  StrCpy $1 "$0\steam\games"
!endif

FunctionEnd

See Also