mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 79
A
Ancyker Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Feb 2003
Posts: 79
say the servers name is irc.myirc.net, and i use irc.us.myirc.net to connect to it, instead of getting irc.myirc.net i want the address i used to connect, irc.us.myirc.net, how to do that? i was hoping for something like $rserver to return it, i was thinking of something like this:
alias server {
set %lastconnected.server $1
set %lastconnected.port $1
}
alias rserver {
if ($prop == server) return %lastconnected.server | halt
if ($prop == port) return %lastconnected.port | halt
if ($prop == all) return %lastconnected.server %lastconnected.port | halt
else { return %lastconnected.server }
}

the problem in that is that it only can retrive the data of the last server connected to, not the current one, so if i connect to irc.us.myirc.net and then connect to irc.us.myotherirc.net then it will return irc.us.myotherirc.net even when calling it from a script that is being processed on irc.us.myirc.net

It all seems very confusing.

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Quickly thinking about it, that is really a difficult problem to solve. First idea would be to use cid's, but the new status window hasn't been created and therefore you can't use the cid yet. It would seem as though you would have to come up with some way to associate the value of $server with the value you really want. I can't really think of any way to do that off the top of my head. This would be yet another reason why (I forget who suggested it) scid specific variables would be useful.

Joined: Feb 2003
Posts: 79
A
Ancyker Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Feb 2003
Posts: 79
i found out something kind of useful...

$serverip
Returns server IP address.

but for some odd reason, it appears backwards

1.0.0.127
76.55.65.216

???

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Yeah, thats a bug.

Joined: Feb 2003
Posts: 79
A
Ancyker Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Feb 2003
Posts: 79
Resolved the issue, just incase someone encounters this in the future the code to fix it is
alias nserverip {
set %i1 $gettok($serverip,1,46)
set %i2 $gettok($serverip,2,46)
set %i3 $gettok($serverip,3,46)
set %i4 $gettok($serverip,4,46)
set %i %i4 $+ . $+ %i3 $+ . $+ %i2 $+ . $+ %i1
return %i
}

then use $nserverip

Joined: May 2003
Posts: 161
A
Vogon poet
Offline
Vogon poet
A
Joined: May 2003
Posts: 161
no need for all that code, you can just do
Code:
nserverip tokenize 46 $serverip | return $+($4.,$3.,$2.,$1)


Link Copied to Clipboard