mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2003
Posts: 325
W
Wolfie Offline OP
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
Ok, trying to keep it simple:

Let's say that I have, in my server list, the following two enteries:

/server -a irc.chat.com -g Group111 -d Group 111
/server -a irc.chat.com -g Group222 -d Group 222

(Trust me, what you see is intentional)

If I make 2 connections, one to Group111, the other to Group222, then how can I find out the name of the group I chose to connect to?

$network is unreliable, as it can be changed by the irc server... can do a server search because that will only return the enteries, not limit it to what you are connected on at the time.

My thought is that if another identifier was made, such as $nid (for Network ID) or $NetworkID, and it reports what server-group was used to make the current connection, it could open up usability in scripts that make multiple connections to the same network, but use the group id to determine their functions. ($cid doesn't cut it, as the numbers are not necessarily going to be the same each time).

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Something like $server(irc.server.net).group perhaps?


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Well, you could script it easily enough, but not a bad idea.

qwerty: $server($server).group will always return the first matching entry in servers.ini.

Joined: Aug 2003
Posts: 325
W
Wolfie Offline OP
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
I actually have something scripted which takes the email address (after the @) and uses that to create the id so that I can name it whatever I want to. Problem is that I shouldn't have to do that and that if I want to connect to a different network, then have to write an entire /server line.

I was, at one point, writing my own 'server' alias, but then parsing the line to either add in a new switch or to have it look up the group because unreliable. What I'm thinking is that if someone were to write an alias & identifier, at least in the method I'm thinking, /server would somehow figure out the group name, store it in a hash table via "$calc($scid(0) + 1)" if it's a server -m command. Then it'd be easy to call on it.

Just still think it'd be more reliable if it were included internally from within mirc itself. Heck, could even be an alternate $server identifier in that $nid(name) would return the description, $nid(server) would return what was used to connect to the server, instead of doing multiple look ups. grin Of course, that'd all be added gravy. I'll be happy with just a simple $nid (or again, $NetworkID) identifier.

I will note that in v6.03, $network would return which group you used to connect, unless you connected somewhere that changes $network to its own name, but then in the latest version (6.14, which I am using), $network has started referring to the first group it finds in the server list. So somewhere in version releases, that got changed.
:-\

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Well, heres a basic $nid whch returns the groupname used in the /server command.
  • on ^*:logon:*:set %nid. $+ $cid $network
    alias nid return %nid. [ $+ [ $cid ] ]
    on *:exit:unset %nid.*

Joined: Aug 2003
Posts: 325
W
Wolfie Offline OP
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
* Wolfie blinks
Never noticed that one before.. I'll have to try that (at least until(if) it becomes available internally in mirc (pleasde Khaled?))

Of course, I'll just convert that to use hash tables. I hate using %'s smile

Thanks a bunch dood.
grin

Slight note: Still gonna have to rewrite the server though, but will be way more simple.. If it's just /server, then it intentionally reconnects to the last $network. smile Yes, I've been pulling my hair out on this.

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
No need to write a /server alias, you can do /server group111 and it will record the "group111". smile

edit: It also works from connecting via the connect icon smile

Last edited by Iori; 26/04/04 04:58 PM.
Joined: Aug 2003
Posts: 325
W
Wolfie Offline OP
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
I mean if on a connection, like say on group111, and then using /server someothernetwork
Because I've noticed that just reconnecting to the server will return the wrong network
so: alias server if ( $0 < 1 ) !server $nid
smile
Simple but does the trick
That way when LOGON triggers again, and just stores the information, it won't be complex like checking to see if something is already there, deciding if it should store the new $network, etc.
I try to consider all my past experiences when making scripts, and I try to make use of new knowledge to simplify it.
grin


Link Copied to Clipboard