mIRC Home    About    Download    Register    News    Help

Print Thread
#111424 15/02/05 06:32 PM
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
on *:dns:{
set % $+ $dns(1).nick $+ _ip = $dns(1).ip
set % $+ $dns(1).nick $+ _adress = $dns(1).addr
var %i = 1
echo 4 -a * DNS Result:3 Nick: %nick / Adress: $(% $+ %nick $+ _adress) / IP: $(% $+ %nick $+ _ip)
unset %nick
}
menu nicklist {
-
Check Ip From $$1:set %nick $$1 | dns $$1
-
}

Why doesn't this work?
Echoes:
* DNS Result: Nick: Nickname / Adress: %Nickname_adress / IP: %Nickname_ip

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Well think about it logically. $eval will evaluate to a certain specified level. You specified no level, which makes it evaluate to the default of 1.

With doing this, you end up with the variable names, not their value.

What does this mean?

It means you need to evaluate 1 level further, so you specify $eval(..,2)

Btw you are making this unnecessarily complex with the dynamic variables.


Gone.
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
Yeah but I'm going to use these vars in other parts of my script too, so that I don't need to dns everyone everytime I want to use their ip.
Thanks for the indeed logical solution!

Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
using $(...,2) but this returns:
* DNS Result: Nick: Nickname / Adress: = xxxxxxx.xxxxxx.xxxxx.xx / IP: = xxx.xxx.xxx.xxx
Why is the = there?

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Because you put them there when setting the vars.

Set doesn't use the = operator like "set %variable = value" that is only with" var %variable = value" or when assigning a value to a variable like "%variable = value"

So use "set %variable value" instead and they won't be there.


Gone.
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
Thanx, that slipped my mind.

Joined: Nov 2004
Posts: 332
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Nov 2004
Posts: 332
simple thing really you plan to use them elsewhere so they must be globals which employ /set as opposed to local variables which can only be called from within the script that creates them /var
i dont know why im telling you this since your a better scriptor than i am maybe for others benefit


The Kodokan will move you, one way or another.
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
You should really check for $dns().nick so if you dns an address\ip you don't end up with
%_ip 209.240.130.48
%_adress mirc.com
* DNS Result: Nick: / Adress: mirc.com / IP: 209.240.130.48

Code:
on *:dns:{
[color:blue]  if $dns(1).nick {[/color]
    set $+(%,$v1,_ip) $dns(1).ip
    set $+(%,$v1,_adress) $dns(1).addr
    echo 4 -a * DNS Result:3 Nick: $v1 / Adress: $($+(%,$v1,_adress),2) / IP: $($+(%,$v1,_ip),2)
[color:blue]  }[/color]
}

Now you don't need to set %nick
Code:
menu nicklist {
  -
  Check Ip From $$1:.dns $$1
  -
}


Link Copied to Clipboard