* Original Thread * (
http://www.lucasforums.com/showthread.php?t=207091)
-----
Before We Get Started id like to say Hi, :thmbup1:
I know i have hardly any posts at the time of making this but trust me when i say i got plenty of experience in modding have done a little of everything but
Skinning is my primary Forte. I Will go through Step by Step very Detailed and without a giant wall of text!! i know its un-heard of in a scripting tutorial
this will Work for Everything, i will explain sending different Files to different locations in Segment 3
Want to see an Example of what im talking about First..
Check out my mod that i learned this for Nvenoms Custom Interface (
http://www.lucasforums.com/showthread.php?t=207092)
Okay on with the Goods,
REASON:We Will be Scripting our Installer using something im sure all true modders will Love, i learned this because i was working on a mod, finished and releasing at the time of this post called Nvenoms Custom Interface (
http://www.lucasforums.com/showthread.php?t=207092) it contained a little over 4000 Files But when installing you needed a little more than 200, why you ask...because it had !!!!!MULTIPLE CHOICE'S!!!!!!!
I Searched for eons for a proper installer that had this, i could not find any so here we go super simple (for everyone i hope)
Just need 3 things
NSIS
http://nsis.sourceforge.net/Download) our main Program
Notepad++
http://notepad-plus-plus.org/downloadThis) will help you keep up with Your Scripting and help you Conquer that wall of text i said i wasint going to create....:dev9:
Last but not least a little tiny voice in Your head that says you can do this...
Now Dont go opening up Nsis just yet, First we are Going to make our Script.
Start up Notepad++ and begin a new File, Our Readme/License
Type what ever you want in it dosent have to be special can be something as simple as Hello World
Once You are done Save it on your DESKTOP as ReadLNew.nsi/// .NSI Make sure you save it as that
Now We Start our Scripting Open up another new txt in Notepad++ by using File> New in the top left ( Shouldint have to say this)
Start With
;This is What your Mods Name is
Name "Your Mods Name"
;This is what the EXE that they will use to install it will be called
OutFile "Your Mods Name.exe"
;This is Were those Files will be dumped that you put in the installer
InstallDir $PROGRAMFILES\LucasArts\SWKotOR\Override
;License Text is just a base name for it;License Data is the File it will read
LicenseText "Readme/License"
LicenseData "ReadLNew.nsi"
;This Will make it ask for Administrative Rights to overwrite any Files
RequestExecutionLevel admin
;this is the end of are first Segment Always end it with a block like this
;---------------------------------------------
Second Segment
; Pages are the Second Segment Fairly short and simple for a Selection installer. Pages execute Forms (just Giberish) in order so you want to keep them just like mine. they do nifty stuff like forcing people to agree to your terms :thmbup1: if they want Your mod
;This is the Page that executes that Readme/License That you made, And it does it first so they cant go any further without reading it
Page License
;This Opens a page you cant see, what it does is tells the program its going to be reading some Section Variables (More Giberish)
Page Components
;This Tells the installer that it will be giving options instead of Forcing choice's they cant see
Page Directory
;This Takes are application to its Final Page Unloading are files to Said Destination and even giving an option if there override folder is somewere else
Page instfiles
;And we end the second Segment with our Block
;-----------------------------------------
Third Segment
;The Third Segment Consists of the Files that will be unloaded into the override folder, Im guessing you already have your files in order
;The Section is what your option will be called so lets say ur doing a choice of 5 weapon packs they can install
Section "Name your choice (e.g weapon pack 1)
;This Is the directory confirmation if you change it, it will put the file somewere else, ill give you a example
SetOutPath $INSTDIR ;Sends the files to that locations you set in segment 1
;InstallDir $PROGRAMFILES\LucasArts\SWKotOR\Override
;Change it to this however it will will drop the file in your modules folder
SetOutPath $PROGRAMFILES\LucasArts\SWKotOR\Modules
;Now we are onto were you List the files that will be compiled and eventually used, Goes just like this you must enter each file individualy in long lists depending on what folder they are going into ill give example at the end of this but for now ill just give a short one and i even have a handy trick to getting tons of file names instantly into one little text file *Yes cj is my name, and if ur wondering im 16.. i know not a big suprise*
File C:\Users\CJ\Desktop\MainColors\Black\1024x768comp0 .tga
File C:\Users\CJ\Desktop\MainColors\Black\1024x768comp1 .tga
;And now im gunna add some random file to my modules by just including another SetOutPath, i can do that because the programing run in the order that you type it
SetOutPath $PROGRAMFILES\LucasArts\SWKotOR\Modules
File C:\Users\CJ\Desktop\MainColors\Black\lbl_cg_abilbk .tga
File C:\Users\CJ\Desktop\MainColors\Black\lbl_cg_circ1. tga
;And just like that we are finished, to add more choices simply add a new Section and dont forget to always end with SectionEnd it closes it off so the compiler knows its ither finished or ready to move onto the next Section, dont have to end Sections with Blocks but you can if you want, if you look into Segment 4 You will see what we have done now and i will move onto compiling it with 2 easy clicks (maybe more i never actually counted):¬:
SectionEnd
Segment Four;Here is what we Have so far
Name "Nvenoms Tutorial"
OutFile "Nve's Tutorial.exe"
InstallDir $PROGRAMFILES\LucasArts\SWKotOR\Override
LicenseText "Readme/License"
LicenseData "ReadLNew.nsi"
RequestExecutionLevel admin
;--------------------------------
; Pages
Page License
Page components
Page directory
Page instfiles
;--------------------------------
;--------------------------------
Section "Random Files 1"
SetOutPath $INSTDIR
File C:\Users\CJ\Desktop\MainColors\Black\1024x768comp0 .tga
File C:\Users\CJ\Desktop\MainColors\Black\1024x768comp1 .tga
SetOutPath $PROGRAMFILES\LucasArts\SWKotOR\Modules
File C:\Users\CJ\Desktop\MainColors\Black\lbl_cg_abilbk .tga
File C:\Users\CJ\Desktop\MainColors\Black\lbl_cg_circ1. tga
SectionEnd
;---------------------------------
Section "Random Files 2"
SetOutPath $INSTDIR
File C:\Users\CJ\Desktop\MainColors\Black\lbl_abilities .tga
File C:\Users\CJ\Desktop\MainColors\Black\lbl_autopause .tga
SetOutPath $PROGRAMFILES\LucasArts\SWKotOR\Modules
File C:\Users\CJ\Desktop\MainColors\Black\lbl_optback.t ga
File C:\Users\CJ\Desktop\MainColors\Black\lbl_optingame .tga
SectionEnd
;Once you have yours with as many Sections as you would like save it to DESKTOP as
modname.nsi//.NSI!!!!!
Open up Nsis and click Compile Nsi Script
http://i763.photobucket.com/albums/xx279/revap121/NsisMain.jpg)
Moving on to Segment 5 just to make things a little less Crowded
Segment Five
http://i763.photobucket.com/albums/xx279/revap121/NsisCompiler-1.jpg)
1. Recompile: it reloads your .nsi files if you have made any changes to it
2.Test Installer: Click this once your recompile has gone through, if it fails it wont allow you to click it (we will talk about errors in Tips Segment
3.Open:This is what your going to click to Open your modname.nsiFile
4.Script:> Set compressor is in there if you set it to LMZA it will squish your file down to the smalist size possible usually cutting it in half or more, will take longer depending on how good your computer is
So to Recap What your going to do to compile your mod is first use 3# and open your modname.nsiFile than you are going to let it run till the blue button #1 Goes Full Blue (allows you to click it) than once it is done you will ither get Success
http://i763.photobucket.com/albums/xx279/revap121/NsisCompiler.jpg) or some Form of This Script has Failed if it failed Go to Tip's Segment if it succeded you will be able to click #2 Test program button and try out your application looking like this
http://i763.photobucket.com/albums/xx279/revap121/ReadmeSuccess.jpghttp://i763.photobucket.com/albums/xx279/revap121/Select.jpg)
If all went well a .EXE will be on your desktop that you can distribute to the modding community
Tips/Tricks SegmentI Know, it just keeps going on and on lol, anyways here is my tricks i used to make it through the rough times.
First of all If ur getting an error about it Not finding Files Try putting your files in a folder with no spaces
e.g c:\programfiles\my Mods\ blah blah blah = Wrong
right c:\programfiles\mym\ blah blah blah = yay.. the crowd goes Wild
Getting the Names of every Item in a folder placed on a .txt file
1. Open the Windows Explorer (Windows key + E)
2. Browse to your folder with all the files, e.g. C:\Users\[yourusername]\Pictures
3. Click on the address bar, select it and copy the entire address via CTRL + C (hold both)
4. Open up a command prompt (click on the link if you don’t know how)
Once Open right Click on the bar at the top and click Properties, Check the box that says quick edit
5. Now Type cd and than right Click to insert the address that we copied into our clipboard in step 3.
[e.g] cd C:\Users\CJ\Desktop\MainColors\Black
6. Hit enter
7. Enter DIR /B /O:N > filenames.txt (filenames.txt is the name of the txt file)
8. Now open the folder where your files are stored and open the text file filenames.txt
9. Congratz, you have just copied all file names from a folder and stored them into a text file.
Tip:
Should you want to copy files names not only from a folder, but from sub-folders as well, you simply add a /S for subdirectories to the command: DIR /B /O:N /S > filename.txt
You will still have to put File infront of every item you copy from that text file to your script, it olmost killed me doing it 4000 times XD
/////////////////////////////////////////////////////////////////////////////////////
If you experienced an error while compiling it should say something at the bottom like
Error in script "C:\Users\CJ\Desktop\Nvenoms Tutorial.nsi" on line 37 -- aborting creation process
Just Link the Error in Script that it is giving you in the Thread and Your Script and ill help ya out
For Modders Wanting to Edit other Parts of Files!! As Qui-Gon Glenn informed me My Installer lacks a sense of editing .2da files and of other sorts that only TSL patcher can do.. Here is a workaround. Time for another Segment for you .2da editors *May seem pointless to some*
;Okay so you have your Script all typed up and its looks awsomly formal and contains all of your files, But for some reason you need to change a file that only TSL patcher has the capability to do But you want to keep your Options. Here is what we are going to add to the very end or Sections and it does all the Work XD
;Im Using Fraps as an example.
Section "Fraps"
File "C:\Fraps\fraps.exe"
ExecWait '"Fraps" /i "$INSTDIR /passive'
SectionEnd
;So how does this Help, well it can actually package a TSLpatcher you have created to edit just that .2da file into your installer and When your installer is done with unloading all of your files into Override it will open up that TSLinstaller and install your .2da data
;Now Say you want to make it so they have no choice but to install that part of your mod, we are gunna add just one string of text to it
Section "Fraps"
SectionIn RO
File "C:\Fraps\fraps.exe"
ExecWait '"Fraps" /i "$INSTDIR /passive'
SectionEnd
;SectionIn RO set the Section in a Required Option Motion Causing it to lock the box, Very simple Sturdy tool to make sure they get what they need
;Here is My New TSL enhance map Script with M4-78's Map Files Packed in and when its done installing both those it will launch my TSLInstaller
Name "Nvenoms TSL Map Enhancment"
OutFile "Nve's T.M.E.exe"
InstallDir $PROGRAMFILES\LucasArts\SWKotOR2\Override
LicenseText "TSL Enhanced Map"
LicenseData "420.nsi"
RequestExecutionLevel admin
;--------------------------------
; Pages
Page License
Page components
Page directory
Page instfiles
;--------------------------------
;--------------------------------
Section "Enhanced Maps"
SectionIn RO
SetOutPath $INSTDIR
File C:\Users\CJ\Desktop\EnMaps\lbl_map001EBO.tga
File C:\Users\CJ\Desktop\EnMaps\lbl_map002EBO.tga
File C:\Users\CJ\Desktop\EnMaps\lbl_map003EBO.tga
File C:\Users\CJ\Desktop\EnMaps\lbl_map101per.tga
File C:\Users\CJ\Desktop\EnMaps\lbl_map102per.tga
File C:\Users\CJ\Desktop\EnMaps\lbl_map103per.tga
File C:\Users\CJ\Desktop\EnMaps\lbl_map104per.tga
File C:\Users\CJ\Desktop\EnMaps\lbl_map105per.tga
File C:\Users\CJ\Desktop\EnMaps\lbl_map106per.tga
File C:\Users\CJ\Desktop\EnMaps\lbl_map151har.tga
SectionEnd
Section "M4-78 Enhanced Maps"
SetOutPath $INSTDIR
File C:\Users\CJ\Desktop\m478maps\lbl_map801DRO.tga
File C:\Users\CJ\Desktop\m478maps\lbl_map802DRO.tga
File C:\Users\CJ\Desktop\m478maps\lbl_map803DRO.tga
File C:\Users\CJ\Desktop\m478maps\lbl_map804DRO.tga
File C:\Users\CJ\Desktop\m478maps\lbl_map805DRO.tga
File C:\Users\CJ\Desktop\m478maps\lbl_map806DRO.tga
File C:\Users\CJ\Desktop\m478maps\lbl_map807DRO.tga
SectionEnd
Section "TslExample"
File "C:\Users\CJ\Desktop\TslExample.exe"
ExecWait '"TslExample" /i "$INSTDIR /passive'
SectionEnd
;And that is my Workaround. Post in the thread if you need any Help.
*Works With Any .exe not just installers, However if you put a program in it to run, it wont work unless u also inclue all the files that program needs to run*
Section "TslExample"
File "C:\Users\CJ\Desktop\TslExample.exe"
File blahasdjhawdkajsdh
File asjhasdjhasdjhas
file ajsdjakhwjdhasd
ExecWait '"TslExample" /i "$INSTDIR /passive'
SectionEnd
;Like So>> And i know, why go through all this if you can just use tsl patcher in the first place, Mostly Because TSL patcher dosent let us give people a choice of what they want to install, Instead it just asks them were it wants to dump tons of files they know nothing about at
In Final I Want to Say thanks for Reading and i really hope you got it, Without this my modding would have been pointless and far to complicated for anyone to want too bother with. *side note* One of the easiest Scripting languages i have ever try to learn XD