Source Mod Installers: Difference between revisions
Jump to navigation
Jump to search
Note:To automate the FILE1-FILEX list, use the NSIS Script Wizard in HM NIS Edit, then copy the list to your
Note:You might want to be sure to include a ZIP-compressed version of the mod as a download. This will make certain people who do not like third-party setup files will be able to get the mod.
mNo edit summary |
|||
Line 26: | Line 26: | ||
;!define NO_DESKTOP_ICON | ;!define NO_DESKTOP_ICON | ||
!define MUI_ICON "##INSTICO##" | |||
!include "MUI.nsh" | !include "MUI.nsh" | ||
!define MUI_ABORTWARNING | !define MUI_ABORTWARNING | ||
!insertmacro MUI_PAGE_WELCOME | !insertmacro MUI_PAGE_WELCOME | ||
!insertmacro MUI_PAGE_DIRECTORY | !insertmacro MUI_PAGE_DIRECTORY | ||
!insertmacro MUI_PAGE_INSTFILES | !insertmacro MUI_PAGE_INSTFILES | ||
!insertmacro MUI_LANGUAGE "English" | !insertmacro MUI_LANGUAGE "English" | ||
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" | Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" | ||
Line 62: | Line 52: | ||
SectionEnd | SectionEnd | ||
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 | ReadRegStr $1 HKCU "Software\Valve\Steam" SourceModInstallPath | ||
IfErrors | IfErrors 0 lbl_end | ||
ClearErrors | |||
StrCpy $0 "$PROGRAMFILES\Valve\Steam" | |||
StrCpy $1 "$PROGRAMFILES\Valve\Steam\SteamApps\SourceMods" | |||
lbl_end: | |||
StrCpy $INSTDIR "$1\##MODDIR##" | StrCpy $INSTDIR "$1\##MODDIR##" | ||
!ifndef NO_DESKTOP_ICON | !ifndef NO_DESKTOP_ICON | ||
StrCpy $2 "$0\steam\games" | 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]] | ||
* [http://nsis.sourceforge.net/wiki/Main_Page NSIS Wiki] | * [http://nsis.sourceforge.net/wiki/Main_Page NSIS Wiki] | ||
[[Category:Tutorials]] | [[Category:Tutorials]] |
Revision as of 21:05, 21 October 2005
Extra thanks to User:Garry Newman for relaying the basics of a mod installer.
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.

setup.nsi
.
Code from setup.nsi
!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 !define MUI_ICON "##INSTICO##" !include "MUI.nsh" !define MUI_ABORTWARNING !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_LANGUAGE "English" Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "Setup.exe" 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 0 lbl_end ClearErrors StrCpy $0 "$PROGRAMFILES\Valve\Steam" StrCpy $1 "$PROGRAMFILES\Valve\Steam\SteamApps\SourceMods" lbl_end: StrCpy $INSTDIR "$1\##MODDIR##" !ifndef NO_DESKTOP_ICON StrCpy $2 "$0\steam\games" !endif FunctionEnd