mIRC Home    About    Download    Register    News    Help

Topic Options
#157536 - 25/08/06 11:12 PM $eval
HaleyJ Offline
Fjord artisan

Registered: 01/07/06
Posts: 242
Loc: London the city i love
Hi
I would like to understand what the identifier $eval does, i looked in the help file and didnt really understand. I have seen it being used in alot of scripts here. Also is it possible to give an example.

The same goes for regex i have seen used alot but dont understand.
Thank-You
_________________________
Newbie

Top
#157537 - 25/08/06 11:27 PM Re: $eval
hixxy Offline
Hoopy frood

Registered: 06/09/05
Posts: 2876
Put this in your variables tab and hit the ok button:

%a %b
%b %c
%c %d
%d %e
%e 5

Then type:

Code:
//echo -a $eval(%a,0) ~ $eval(%a,1) ~ $eval(%a,2) ~ $eval(%a,3) ~ $eval(%a,4) ~ $eval(%a,5)


The output is:
%a ~ %b ~ %c ~ %d ~ %e ~ 5

$eval(%a,0) evaluates %a 0 times, so it stays as "%a", without being interpreted as a variable at all.
$eval(%a,1) evaluates it once, so it will return %b, without evaluating %b
$eval(%a,2) will first evaluate %a to %b, and then %b to %c, because it's evaluating twice.
$eval(%a,3) will do %a to %b, then %b to %c, then %c to %d
$eval(%a,4) will do %a to %b, then %b to %c, then %c to %d, then %d to %e
$eval(%a,5) will do %a to %b, then %b to %c, then %c to %d, then %d to %e, then %e to 5.

Top
#157538 - 26/08/06 12:16 AM Re: $eval
SCNDRL Offline
Babel fish

Registered: 19/12/05
Posts: 58
Loc: Izmir, Turkey
//set $+(%,me!,$me) $me

%me!SCouNDReL is $me now After that try them ;

Code:
//echo -a $eval($+(%,me!,$me),0) or //echo -a $($+(%,me!,$me),0)
//echo -a $eval($+(%,me!,$me),1) or //echo -a $($+(%,me!,$me),1)
//echo -a $eval($+(%,me!,$me),2) or //echo -a $($+(%,me!,$me),2)
.
.
.


Edited by SCNDRL (26/08/06 12:17 AM)
_________________________
i like that

Top
#157539 - 26/08/06 12:28 PM Re: $eval
Rand Offline
Fjord artisan

Registered: 28/02/05
Posts: 342
As hixxy was pointing out, $eval() will go through the contents and evaluate it to the amount of times you specify.

So if you specify $eval(<text>,0) nothing in $eval() will be evalauated.

If you specify $eval(<text>,1) it will be evaluated once. If you specify $eval(<text>,2) it will be evaluated twice.

As a decent example, in your editbox, you can type (With just ONE backslash):

Let's say your nick is "Peachy"

/set %mynick $me

Then type: //echo -a %mynick

This is only evaluating "%mynick" once, so you will see "$me" as the echo.

Typing: //echo -a $eval(%mynick,0) : will not evaluate %mynick at all, so the only thing echo'ed is "%mynick"

Typing: //echo -a $eval(%mynick,1) : will echo "$me" because it only evaluates the variable, and not what is inside the variable.

Typing: //echo -a $eval(%mynick,2) : will echo "Peachy" because it evaluates %mynick, which is $me, and then evaluates a second time, which turns $me into your nick "Peachy".

Top
#157540 - 26/08/06 01:18 PM Re: $eval
HaleyJ Offline
Fjord artisan

Registered: 01/07/06
Posts: 242
Loc: London the city i love
Thanks you have all been very helpful.
_________________________
Newbie

Top