mIRC Home    About    Download    Register    News    Help

Print Thread
#157536 25/08/06 10:12 PM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
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
#157537 25/08/06 10:27 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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.

#157538 25/08/06 11:16 PM
Joined: Dec 2005
Posts: 58
S
Babel fish
Offline
Babel fish
S
Joined: Dec 2005
Posts: 58
//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)
.
.
.

Last edited by SCNDRL; 25/08/06 11:17 PM.

i like that
#157539 26/08/06 11:28 AM
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
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".

#157540 26/08/06 12:18 PM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
Thanks you have all been very helpful.


Newbie

Link Copied to Clipboard