mIRC Homepage
Posted By: jnintemann automatically find scon # - 09/09/06 01:26 AM
i made this for a script i was using to mirror stuff between channels and i didn't want to have to keep opening servers in the same order.
i remember a few people asking about something like this before so i figured i'd post it. sorry if something similar has been posted before.
what this does is it creates a $findnetwork identifier that uses the network name to find the scon # and return it's value.
example:
/scon $findnetwork(EFnet)
that will switch the script to the EFnet network. (assuming you are connected to that network.)
if you try to find a network that you are not connected to, it returns $null

Code:
/findnetwork {
  var %nextnet = 1
  scon %nextnet
  while ($network != $null) {
    if ($network == $1) { return %nextnet }
    inc %nextnet
    scon %nextnet
  }
  return $null
}


if anyone has some tips to make the script better, i would also like to hear them.
Posted By: Othello Re: automatically find scon # - 09/09/06 02:49 AM
I currently use something simular in one of my scripts
[color:blue]
Code:
alias network {
  var %i = 1
  while ($scon(%i)) {
    scon %i
   < do this command >
    inc %i
  }
} [/color] 
Posted By: xDaeMoN Re: automatically find scon # - 09/09/06 06:12 AM
Here's what I use:

Code:
 alias sc {
  var %o = 1, %p = $$1
  while $scon(%o).network {
    if ( %p == $v1 ) { 
      if ( $prop ) return $($+($,scon(%o).,$prop),2)
      else return %o
    }
    inc %o
  }
}  


An identifier that is similar to $scon but instead of giving the Nth connection, you give the network name.

Syntax: $sc(Network)[.identifier]

Sample: //echo -a $sc(undernet).me -> will give your current nick in undernet.
Posted By: schaefer31 Re: automatically find scon # - 09/09/06 11:47 PM
I use this one by FiberOPtics, which is very versatile: $findcid(),
Posted By: Jae Re: automatically find scon # - 10/09/06 09:56 PM
i made a feature suggestion just before about being able to name connections and call them by name, surely the same for network would be an idea too? although multiple connections to a network/server would pose problems but im sure its workable.
© mIRC Discussion Forums