mIRC Home    About    Download    Register    News    Help

Print Thread
Setting a variable with other variables in the $ #199343 12/05/08 08:22 PM
Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
Is it possible to set a variables with other variables within the string? I.E.

set abc $1 $+ hello $+ %2 $+ how are you?

???


I registered; you should too.
Re: Setting a variable with other variables in the $ [Re: AWEstun] #199345 12/05/08 08:32 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Yes.

alias test {
var %1 = apple, %2 = tree
set %var I love this %2 it has so many %1
echo -a %var
}


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Setting a variable with other variables in the $ [Re: AWEstun] #199356 12/05/08 10:39 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
That said, it will set the variable using the contents of the variable you include. It will not leave the variable there for you to manipulate later. If you *do* want to manipulate the variable later, you need to use $eval().

Example:
Code:
var %t = a test
var %c = this is $eval(%t,0)
var %t = not a test
echo -a $eval(%c,2)


That would let you change %t at any time and it would change the output of %c without resetting %c. Note that you may want to be using /set instead of /var depending if you want it global or not. It works the same, though.


Invision Support
#Invision on irc.irchighway.net