Well, first of all, what you pasted that you got as result is impossible, and I'll show you why with this example:

//set -s %search-nick-4 $+ $me blah | echo -a %search-nick-4 $+ $me

As you can see, it will echo your nickname ($me), because the %search-nick-4 variable evaluated to $null (nothing) and $me evaluated to your nickname. This is normal procedure, and if you want to evaluate a dynamic variable you need to take special steps in order to do so.

//set -s %search-nick-4 $+ $me blah | echo -a %search-nick-4 [ $+ [ $me ] ]

//set -s %search-nick-4 $+ $me blah | echo -a $eval( $+(%,search-nick-4,$me) ,2)

//set -s %search-nick-4 $+ $me blah | echo -a [ [ $+(%,search-nick-4,$me) ] ]


What did we just do:

First example

%search-nick-4 [ $+ [ $me ] ]

We used evaluation brackets [ ] to control the order of evaluation. We told it to first evaluate $me by surrounding it with brackets [ ] so you get: [ $me ].
Then we want to evaluate the $+ which concatenates the $me part with the %search-nick-4 part so we put brackets around $+ [ $me ] so that it turns into: [ $+ [ $me ] ]

Now mIRC is left with the following to evaluate: %search-nick-4<nickname>, it does this so you get the correct value (blah) here.

Normally it would have valuated the %search-nick-4 part to $null, but because of evaluation brackets we can determine ourselves in what order the parameters should be evaluated.

Second example

$eval( $+(%,search-nick-4,$me) ,2)

What do we see here? We see an identifier $eval which takes two parameters, first being what you want evaluated, and second to what depth (number).

What do we want to evaluate?

$+(%,search-nick-4,$me)

This first evaluates to %search-nick-4<nickname>, this is evaluation of level 1. But since we want the value of this variable, we need to force it to evaluate one level further, so we put 2 as depth, and it evaluates %search-nick-4<nickname> to its actual value, behing "blah" here.

Why didn't I put $+(%search-nick-4,$me) ? Well because of what I already explained, that would evaluate %search-nick-4 to $null, and $me to your nickname, but we don't want that. Therefore pay specific attention to the $+(%, <-- comma that is used there, so that we are certain that the variable will not evaluate yet.

Note that the things I just explained, are means to retrieve the value of a dynamic variable, for setting you do not need to do this.

//set %search-nick-4 $+ $me will work in 100% of the cases, which you should have seen because I used the -s switch that shows what the variable is set to.

Btw, note that $( ..., N) is the same as $eval( ..., N) just shorter notation, but I reckoned I'd mention it because a lot of people, including myself, use the shorter notation.

Third example

[ [ $+(%,search-nick-4,$me) ] ]

We see a special case, where using double evaluation brackets acts like $eval(<param>, 2) in the sense that it offers you double evaluation (or re-evaluation if you will)

$+(%,search-nick-4,$me) evaluates to %search-nick-4<nickname>, which in part evalutes to "blah", which is then what is echoed.

To show this behaviour with a little easier example:

//echo -a [ [ $!me ] ]

evaluates to your nickname. It first evaluated to $me, and then evaluated $me to <nickname>

Another example:

//var -s %x = $+(%,y), %y = 5 | echo -a $(%x,0) ** %x ** $(%x,2) ** [ [ %x ] ]

-> %x ** %y ** 5 ** 5

By now you should understand exactly why you get that as result.


Gone.