Old 14th August 2003, 22:25   #1
zip_doo_dah
Junior Member
 
Join Date: Apr 2003
Posts: 13
Variables

Hey everyone.
Just curious if the only allowed variables are $R0 - $R9 and $0 - $9. Is this correct? If it is, why can't we have more variables to use. I have some complicated logic that requires a few more variables. Thanks for your help.
-Justin
zip_doo_dah is offline   Reply With Quote
Old 14th August 2003, 22:27   #2
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
The latest development version supports user variables, so you can use as much variables as you want (declared with the Var command). For details see http://nsis.sf.net.

There is also the possibility to use the stack.
Joost Verburg is offline   Reply With Quote
Old 14th August 2003, 23:29   #3
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
Allowed variables are: $0 - $9, $R0 - $R9, $EXEDIR, $INSTDIR, $LANGUAGE, $OUTDIR ,$CMDLINE, and user variables declared with the Var command.

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 14th August 2003, 23:57   #4
zip_doo_dah
Junior Member
 
Join Date: Apr 2003
Posts: 13
Talking

SWEET!!! Excellent addition to the installer and perfect timing in my case. Thanks a million!
-Justin
zip_doo_dah is offline   Reply With Quote
Old 15th August 2003, 10:34   #5
dabossuk
Junior Member
 
Join Date: Jan 2003
Location: London
Posts: 43
Send a message via ICQ to dabossuk
Hi

Having variables is a GREAT new feature :-) ...

is there any reason why you would still need to use Push, Pop etc anymore ? uhm typing being using brian! ... I assume if you want to take add two Var's together MyValue+MyValue2 you could not do this - so you would need to use the stack ? Is the plan to add extra functions to now deal with the new variables ?

Dabossuk
dabossuk is offline   Reply With Quote
Old 15th August 2003, 10:40   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Using the stack is still recommended for functions because functions can have conflicting variable names. It's also good practice in general to not waste too much memory and find better algorithms that manage with a minimum amount of memory.

Adding two variables is possible. What new functions are you talking about? StrCpy, IntOp, StrLen and every other instruction already works with user variables.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 15th August 2003, 11:57   #7
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Using registers ($0-$9, $R0-$R9) is especially recommended for shared functions and functions that will be distributed (like NSIS Archive code). This will prevent any naming conflicts and save memory.
Joost Verburg is offline   Reply With Quote
Old 20th August 2003, 14:42   #8
zip_doo_dah
Junior Member
 
Join Date: Apr 2003
Posts: 13
Unhappy

Wow, I feel pretty stupid. I want to update my nsis install so that I can declare variables with the var command, but my ignorance seems to be blocking my progress. How do I update my nsis to get this to work? I have nsis2.0b3 installed.

- Justin
zip_doo_dah is offline   Reply With Quote
Old 20th August 2003, 14:47   #9
zip_doo_dah
Junior Member
 
Join Date: Apr 2003
Posts: 13
forget it. i think i may have figured it out. thanks anyway.
zip_doo_dah is offline   Reply With Quote
Old 20th August 2003, 14:48   #10
dabossuk
Junior Member
 
Join Date: Jan 2003
Location: London
Posts: 43
Send a message via ICQ to dabossuk
Hey a question I can answer ;-)

You need NSIS 2 B4 - which for some reason has not been "offically" released yet - but we are now using.

You can get from - the nightly build of NSIS -http://nsis.sourceforge.net/nightly/nsis.zip just unzip over the top of your NSISB3 install.

Be warned though thath the ModernUI has been changed - so read my posts I made with this problem - the others helped me fix it ;-)

Hope that helps ....
dabossuk is offline   Reply With Quote
Old 20th August 2003, 14:54   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
I try not to use custom variables, because it uses up more memory on run-time.

I use defines instead like so:

!define ${VAR1} $0
!define ${INSTDIR2} $1

Function blah
ReadRegStr ${VAR1} HKLM "Software\Quake II" "Install Location"
StrCpy ${INSTDIR2} ${VAR1}
FunctionEnd

-Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump