mIRC Home    About    Download    Register    News    Help

Print Thread
/scon -n networkname [n] [command] #265316 30/03/19 03:24 PM
Joined: Feb 2003
Posts: 2,669
Raccoon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,669
Request to extend /scon to support a network name instead of number, or in combination with a number if connected to the same network multiple times. This can be implemented with or without a new command switch, eg, -n.

scon freenode
msg ##mirc Greetings from EFnet!
scon -r


/scon freenode /msg ##mIRC hi.
/scon freenode 2 /msg ##mIRC hi.
/scon -n freenode 2 /msg ##mIRC hi.


I don't think the -n switch is wholly necessary, given that /scon is currently only looking for a switch or a number for the first parameter, so introducing a text string should be easy to recognize as a network name. Or network/group/serveraddress name. I guess if the -a switch is to work along with a network name, then an -n switch would indeed be necessary.

As an aside, for anyone who needs something to help them navigate their connections, here's a scripted function that will help. It goes in your Aliases section.

Code:
; $networkcid(network-wildcard, [n]) -- returns the nth matching connection id of the given network name.
; example: //scid $networkcid(freenode) msg ##mIRC Hello from EFNet!
; example: //echo -a You are connected to $networkcid(*net*,0) networks with "net" in their name.
networkcid {
  var %netwild = $1, %nth = $iif($2 isnum,$2,1)
  var %i = 1, %n = $scon(0), %ith = 0
  while (%i <= %n) {
    if (%netwild iswm $scon(%i).network) inc %ith
    if (%ith == %nth) return $scon(%i)
    inc %i 
  }
  if (%nth == 0) return %ith
} ; by Raccoon 2019


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: /scon -n networkname [n] [command] [Re: Raccoon] #265350 03/04/19 03:51 PM
Joined: Jul 2006
Posts: 3,588
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,588
In addition, I'd like to see /scon -1 supported, to act on the lastest status windows (clarification for Saturn: it would be the same as using $scon(0), not $lactivecid)


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net