mIRC Home    About    Download    Register    News    Help

Print Thread
#79744 18/04/04 03:41 AM
Joined: Apr 2004
Posts: 2
Q
Bowl of petunias
OP Offline
Bowl of petunias
Q
Joined: Apr 2004
Posts: 2
say $var1 = "$var2"

how do i make $var1 equal to the variable that is inside it?

Joined: Mar 2004
Posts: 526
Fjord artisan
Offline
Fjord artisan
Joined: Mar 2004
Posts: 526
After sending you here to the msg board, i talked with a good scripter, and if I understand what your trying to do... then look at /help $eval it may resolve your problem. If not, stop back into either #helpdesk or #mirc on dalnet (or #mirc on other networks) and see if you can better describe exactly what your trying to do. (or better describe exactly what you want here).. I think $eval of var1 after the set may do what you want.

sample code:

evaltest {
set %foo shimmy
set %bar %foo
echo -- $eval(%foo,2)
}

Last edited by HorseC; 18/04/04 05:02 AM.

Help others! It makes the world a better place, Makes you feel good, and makes you Healthy!
Joined: Apr 2004
Posts: 2
Q
Bowl of petunias
OP Offline
Bowl of petunias
Q
Joined: Apr 2004
Posts: 2
I've used something similar in PHP before, so I figured this would work

on 1:TEXT:\var*:%chan:{
/set %var1 $eval($2,1)
.notice $nick %var1
}

This returns the input, and if i set it to two, it doesn't return anything at all.

Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Easiest is to use $eval( string , number of times to evaluate it ) ... like this:

Assume the following variables and their associated values:

%a = %b
%b = %c
%c = %d
%d = 27

Using $eval( ) to evaluate %a allows you to specify the depth of evaluation you want.

$eval([color:#600080]%a, 0)[/color] doesn't evaluate anything, it just returns what you gave it (useful in timers and in /scon -a commands), so it returns %a.

$eval([color:#600080]%a, 1)[/color] evaluates %a one time and returns its value: %b.

$eval([color:#600080]%a, 2)[/color] evaluates %a twice, thus it returns %b's value, which is %c.

$eval([color:#600080]%a, 3)[/color] likewise re-evaluates it again and returns %d.

$eval([color:#600080]%a, 4)[/color] finally returns 27, the end of the line "real" value for this example.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
That isn't a very good idea, considering you could exploit that code with $findfile.
\var $findfile(c:,*.*,1,quit)
That would you make you quit.


New username: hixxy

Link Copied to Clipboard