Archive: Needing help with the whole thing


Needing help with the whole thing
Ok, Ive just downloaded NSIS and i want to make an installer, first, i have a game called Arma, and i want to make an installer that installs a mod folder into the main game directory, first i need a folder called @slraddons_120_ace in the main directory, and then i need two sub directorys in the @slraddons_120_ace called addons and server keys.

The main directory is C:\Program Files\Bohemia Interactive\ArmA and i want it to be C:\Program Files\Bohemia Interactive\ArmA\@slraddons_120_ace when i install the mod folder.

I also need a arma shortcut with the target line as, "C:\Program Files\Bohemia Interactive\ArmA\arma.exe" -nosplash -mod=@ACE;@slraddons_120_ace

But sometimes on diffrent pcs they have diffrent directorys, so on my friends he has Program Files (84x)\Bohemia Interactive\ArmA\ so i need it to auto detect arma.

Can anyone tell me, or help me with what to do, im a complete beginner with this, i tryed HM NIS Edit but thats bugged.

Thank you


This should do the trick:
InstallDir "$PROGRAMFILES\Bohemia Interactive\ArmA"
Put it somewhere on top of the script. Due to the fact, that your installer is an 32bit (x86) application, windows will always redirect it to "Program Files (x86)" on x64 systems.
Registry keys will be stored in Wow6432Node due to this as well.
So you only need to do some extra work if you want to install an 64bit application with NSiS.

But if you don't fear the extra work, you can also detect the games path by checking for it's registry value.
Because not everyone uses the default install folder and would need to make the install point to his install path.


I put SetOutPath "$DESKTOP\"
File "..\..\..\Program Files\Bohemia Interactive\ArmA\arma.exe"
CreateShortCut "$INSTDIR\Sahrani Life Reloaded Ace.lnk" "$INSTDIR\arma.exe -nosplash -mod=@ACE;@slraddons_120_ace"

Is that right?


Originally posted by striker(PANDA)
I put SetOutPath "$DESKTOP\"
Setting SetOutPah to $DESKTOP will make NSiS copy all files on the users desktop.
Set SetOutPath to "$INSTDIR\@slraddons_120_ace".
if you copied and pasted the line from my first post into your script, SetOutPath should point to {Program Files}\Bohemia Interactive\ArmA.
By setting SetOutPath to "$INSTDIR\@slraddons_120_ace", NSiS will copy all files to {Program Files}\Bohemia Interactive\ArmA\@slraddons_120_ace.

Originally posted by striker(PANDA)
File "..\..\..\Program Files\Bohemia Interactive\ArmA\arma.exe"
Why are you including the games executable? You should include the mod files only or you'll hurt copyright laws.
Copy the mod files into the same directoy where your script is. Prefereably into a subfolder or things may become messy if there are alot of files. i suggest a subfolder named files or whatever you like.
Write the following into your script:
File "Files\*.*"
And repeat it for every subfolder inside the files dir.
if there's for example a subfolder named scripts, write
File "Files\Scripts\*.*"
if you want NSiS to install the files from the subfolder, set SetOutPath to "$INSTDIR\@slraddons_120_ace\Scripts".
And so on.

Originally posted by striker(PANDA)
CreateShortCut "$INSTDIR\Sahrani Life Reloaded Ace.lnk" "$INSTDIR\arma.exe -nosplash -mod=@ACE;@slraddons_120_ace"

Is that right?
This won't work, because NSiS would put the shortcut into the install dir.
Change it as followed:
SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\Sahrani Life Reloaded Ace.lnk" "$INSTDIR\arma.exe" "-nosplash -mod=@ACE;@slraddons_120_ace" "$INSTDIR\arma.exe"
This places an shortcut named "Sahrani Life Reloaded Ace" on the users desktop, that links to the games executable with the given parameters and the games icon.
SetOutPath needs to be set to $INSTDIR before creating the icons or the "Run in" (or whatever it's called in an english os) of the shortcut will point to your mods directory and the game may refuse to start or ctd.
The file between the last 2 quotes points to the icon file. if your mod got a special icon, include it in the install and point to it.

Thank you so very much, i spent 6hours yestarday trying to sort this, finally i get somewhere (:

ty


This is the NSiS Discusion forum. Didn't you expcet to get some help?

And no problem. Everytime again.
it's not like someone knows everything about something by just lookign at it. ;)


Ye well on some forums they dont seem to help at all. Anyways im working so i will tell you how it goes later, thank you


Emmm odd

It created a shortcut, but it gave me one with this,

Target: "C:\Program Files\Bohemia Interactive\ArmA\@slraddons_120_ace\arma.exe" -nosplash -mod=@ACE;@slraddons_120_ace

And

Start In: "C:\Program Files\Bohemia Interactive\ArmA\@slraddons_120_ace"

Now i need this Target to be: "C:\Program Files\Bohemia Interactive\ArmA\arma.exe" -nosplash -mod=@ACE;@slraddons_120_ace

and Start In: "C:\Program files\Bohemia Interactive\ArmA"

Can you help?

Btw this is my script atm

; Define your application name
!define APPNAME "@slraddons_120_ace"
!define APPNAMEANDVERSION "@slraddons_120_ace"

; Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Bohemia Interactive\ArmA\@slraddons_120_ace"
OutFile "..\..\..\Program Files\Venis\Sahrani Life Reloaded.exe"

ComponentText "Choose which features of ${APPNAMEANDVERSION} you want to install."

DirText "Choose the folder in which to install ${APPNAMEANDVERSION}."

Section "@slraddons_120_ace"

; Set Section properties
SetOverwrite on

Function .onInit
NSIS_SkinCrafter_Plugin::skin /NOUNLOAD
FunctionEnd

; Set Section Files and Shortcuts
SetOutPath "$INSTDIR\addons\"
File "@slraddons_120_ace\@slraddons_120_ace\addons\440cuda.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\440cuda.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\ack_dpd_units.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\ack_dpd_units.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\arma_rpg_fov_cars.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\arma_rpg_fov_cars.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\arpgweapons.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\arpgweapons.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\arpg_common.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\arpg_common.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\barcuda.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\barcuda.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\bwc_alouii.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\bwc_alouii.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\bwc_alouiii.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\bwc_alouiii.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\challenger.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\challenger.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\challenger_b.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\challenger_b.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\challenger_c.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\challenger_c.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\cooter.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\cooter.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\csj_gyroac.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\csj_gyroac.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\EditorUpdate_v102.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\EditorUpdate_v102.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\ffs_felicia.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\ffs_felicia.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\fury.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\fury.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\glt_signs.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\glt_signs.pbo.GLT_ADDONS.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\GNT_PiperWII.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\GNT_PiperWII.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\hemicuda.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\hemicuda.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\mb_hemp.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\mb_hemp.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\mh6_police.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\mh6_police.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\modem_mtb.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\modem_mtb.pbo.smurfCModEmMaik.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\modul_sky.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\modul_sky.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\oldtruck.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\oldtruck.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\oltruc3.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\oltruc3.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\police.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\police.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\red_fix_light.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\red_fix_light.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\rh_de.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\rh_de.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\roadrunner2.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\roadrunner2.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\sahco.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\sahco.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\sig_chargerrt.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\sig_chargerrt.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\slr_vehicles.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\slr_vehicles.pbo.arpgslr120.bisign"
File "@slraddons_120_ace\@slraddons_120_ace\addons\yomies.pbo"
File "@slraddons_120_ace\@slraddons_120_ace\addons\yomies.pbo.arpgslr120.bisign"
SetOutPath "$INSTDIR\server keys\"
File "@slraddons_120_ace\@slraddons_120_ace\server keys\arpgslr120.bikey"
File "@slraddons_120_ace\@slraddons_120_ace\server keys\GLT_ADDONS.bikey"
File "@slraddons_120_ace\@slraddons_120_ace\server keys\RH.bikey"
File "@slraddons_120_ace\@slraddons_120_ace\server keys\smurfCModEmMaik.bikey"
SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\Sahrani Life Reloaded Ace.lnk" "$INSTDIR\arma.exe" "-nosplash -mod=@ACE;@slraddons_120_ace" "$INSTDIR\arma.exe"

SectionEnd

BrandingText "By Striker(PANDA)"

; eof


You should have read more carefully.

Originally posted by CG!

Change it as followed:
SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\Sahrani Life Reloaded Ace.lnk" "$INSTDIR\arma.exe" "-nosplash -mod=@ACE;@slraddons_120_ace" "$INSTDIR\arma.exe"
This places an shortcut named "Sahrani Life Reloaded Ace" on the users desktop, that links to the games executable with the given parameters and the games icon.
SetOutPath needs to be set to $INSTDIR before creating the shortcuts or the "Run in" (or whatever it's called in an english os) of the shortcut will point to your mods directory and the game may refuse to start or ctd.
The file between the last 2 quotes points to the icon file. if your mod got a special icon, include it in the install and point to it.
Read again and try to notice the lines with "SetOutPath" in it.
it's mentioned 2 times. 1 example and 1 explanation.

EDiT:
OK. i see the error. Lemme fix your script.
i'm busy with my own atm, so pls be patient.
P.s.: Did you use an iDE/WYSiWYG to generate that script?

I used Venis IX...

Anyways i really am thankful that you can sort my script out, my friend is getting a bit worried that i cant do it, maybe i can prove him wronge (:

Ty


No problem. Code description at the end of this post.

!include "MUI2.nsh"
XPStyle on
ShowInstDetails "show"
ShowUninstDetails "show"
CRCCheck on
WindowIcon off
AutoCloseWindow false
RequestExecutionLevel user
SetCompressor /SOLID lzma
SetCompressorDictSize 32
SetDatablockOptimize on
SetCompress auto

BrandingText "By Striker(PANDA)"
Name "Sahrani Life Reloaded Ace"
OutFile "Sahrani Life Reloaded Ace V1.20.EXE"
InstallDir "$PROGRAMFILES\Bohemia Interactive\ArmA"

;!define MUI_ICON "install.iCO"
;!define MUI_UNICON "Uninstall.iCO"
!define MUI_HEADERIMAGE
;!define MUI_HEADERIMAGE_BITMAP "Banner.BMP"
!define MUI_ABORTWARNING
;!define MUI_LICENSEPAGE_RADIOBUTTONS

;!insertmacro MUI_PAGE_LICENSE "Licence.TXT"
;!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

VIProductVersion "1.2.0.0"
VIAddVersionKey "Comments" "By Striker(PANDA)"
VIAddVersionKey "CompanyName" "dunno"
VIAddVersionKey "FileDescription" "NSiS-install"
VIAddVersionKey "FileVersion" "2.46.0.0"
VIAddVersionKey "InternalName" "@slraddons_120_ace"
VIAddVersionKey "LegalTrademarks" "uhm..."
VIAddVersionKey "LegalCopyright" "© erm..."
VIAddVersionKey "OriginalFilename" "Sahrani Life Reloaded Ace V1.20.EXE"
VIAddVersionKey "PrivateBuild" "1.0"
VIAddVersionKey "ProductName" "Sahrani Life Reloaded Ace"
VIAddVersionKey "ProductVersion" "1.0"
VIAddVersionKey "SpecialBuild" "0.8.1.5"

Section "install"
SetOutPath "$INSTDIR\@slraddons_120_ace\addons"
File "@slraddons_120_ace\@slraddons_120_ace\addons\*.*"
SetOutPath "$INSTDIR\@slraddons_120_ace\server keys"
File "@slraddons_120_ace\@slraddons_120_ace\server keys\*.*"
CreateShortCut "$DESKTOP\Sahrani Life Reloaded Ace.lnk" "$INSTDIR\arma.exe" "-nosplash -mod=@ACE;@slraddons_120_ace" "$INSTDIR\arma.exe"
SectionEnd

Function .OnInstFailed
Delete "$DESKTOP\Sahrani Life Reloaded Ace.lnk"
RMDir /r "$SMPROGRAMS\@slraddons_120_ace"
MessageBox MB_OK "An error occured during the installation !!!$\r$\n$\r$\nThe installation has been rolled back and all files have been removed.$\r$\nPlease ensure that you got sufficient access rights."
FunctionEnd

Function .OnInstSuccess
SetOutPath "$INSTDIR"
WriteUninstaller "$INSTDIR\SLRAce-Uninstall.EXE"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SLRAce" "DisplayName" "Sahrani Life Reloaded Ace"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SLRAce" "UninstallString" "$\"$INSTDIR\SLRAce-Uninstall.EXE$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SLRAce" "InstallLocation" "$INSTDIR\"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SLRAce" "DisplayIcon" "$INSTDIR\SLRAce-Uninstall.EXE,0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SLRAce" "Publisher" "Striker(PANDA)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SLRAce" "RegCompany" "..."
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SLRAce" "DisplayVersion" "1.20"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SLRAce" "NoModify" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SLRAce" "NoRepair" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SLRAce" "EstimatedSize" "0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SLRAce" "Comments" "NSiS installer by Striker(PANDA)"
FunctionEnd

Section "Uninstall"
Delete "$DESKTOP\Sahrani Life Reloaded Ace.lnk"
RMDir /r "$SMPROGRAMS\@slraddons_120_ace"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SLRAce"
SectionEnd


Features:
- fileinfo's
- install rollback on install failure
- uninstallable using the software panel from windows
- fully tagged

Optional:
- uncomment the lines beginning with an ";"
- bannersize is 150x57
- prefered licence format is RTF (Winword is enough)
- diff icons for the installer or uninstaller

Needed:
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SLRAce" "EstimatedSize" "0" : replace the 0 with the mod's size in bytes
- replace "dunno", "uhm...", "erm..." and "..." with less senseless info's


Made in a minute by using one of my simpler install scripts as template. So don't expect to much of it.
Btw: All handcoded. Most script generators produce code that i just don't like.
And i removed and replaced most variables with statics, so you got something to look at and play around with. ;)

Thank you very much

Btw can you tel me how to add an icon to the Installer?


Originally posted by striker(PANDA)
Thank you very much

Btw can you tel me how to add an icon to the Installer?
You can find this information in the MUI2 readme:
http://nsis.sourceforge.net/Docs/Mod...02/Readme.html

The documentation exists for a reason. A lot of time and effort has been spent on them, so please try to use them.

Sorry, i havent come across these documents before, i will start useing them

Ty


Originally posted by striker(PANDA)
Thank you very much

Btw can you tel me how to add an icon to the Installer?
Why don't you just read what i wrote?
it's already in the code i posted before.
Just remove the ";" at the beginning of the line and edit the filename.
it's mentioned at the end of my last post as well.

You'll have a hard time if you don't read what people write.
Same counts for the docs, faq and code examples.

how can i change the start in command on the shortcut to "C:\Program files\Bohemia Interactive\ArmA" ??


You're joking, right?
Ya, i forgot the needed line in my script, but i mentioned how to change it.
if you want to change it, you need to re-set SetOutPath to match the "Start in" directory of your choice, before you create the shortcuts.

The section should look like this:

Section "install"
SetOutPath "$INSTDIR\@slraddons_120_ace\addons"
File "@slraddons_120_ace\@slraddons_120_ace\addons\*.*"
SetOutPath "$INSTDIR\@slraddons_120_ace\server keys"
File "@slraddons_120_ace\@slraddons_120_ace\server keys\*.*"
SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\Sahrani Life Reloaded Ace.lnk" "$INSTDIR\arma.exe" "-nosplash -mod=@ACE;@slraddons_120_ace" "$INSTDIR\arma.exe"
SectionEnd

CG!, I honestly commend you for your patience, but perhaps you'd better give up trying to give things on a silver platter, and let him follow his own learning curve. The answer to his problem is there in the manual, it should suffice to link him to the section about CreateShortCut:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.4

If he can't figure it out from that... Well, he should probably just give up then. :)


You're right.
i was only trying to deliver this kind of help i was hoping to find as i was learning how to script/code.
But if he's/she's to lazy to read, there's nothing we can do to help.

P.s.: i got most of my info's from the "support" and "developer center" section of the NSiS page. So i can only recommend those pages.


I do read the posts, i am a complete learner, you cant really expect me to just jump right in and to know every little thing by you typeing it,

Im not lazy, i am willing to learn, it takes time and patience to teach.

And no, I wont give up (: i edited the uninstall feature so it uninstalled the mod folder.


And why did you ask question i already had answered???
Just wondering.

And ya, this was another missing line. But like i said:
The script was just a quick edit.

And you should try to learn by using the trial-&-error method.
You can use my script as example. Edit some stuff and see how it works afterwards. The source, MSG mentioned, is a good base to start.

P.s.: This is no forum where people teach you from scratch but more help you out to make it easier for you to learn and understand.
You really gotta teach yourself by reading the docs and examples.


I am learning al the time, and i am really greatful for all of your support mate, thank you