Network Identifier

By DarkCoder on Dec 16, 2009

http://www.hawkee.com/snippet/7003/ - This is Gooshies network alias with some things i added on.
This is just an edit of gooshies network alias that i use that has $network(1).id so it tells you the con id, great for multi server messaging etc and i use it in many scripts. This is 95% gooshies and 5% mine, i do not claim any credit for this other than the edit :P.

Use: //echo -a $network(1) - returns first network
Use: //echo -a $network(1).id - returns first networks connection id
Use: //echo -a $network(0) - returns total number of networks.
Use: //echo -a $network(0).list - Returns a list of networks that you are on seperated by $chr(32)

alias network {
  var %i 1, %n
  while $scon(%i) {
    scid $v1
    if ($status = connected) { %n = $addtok(%n,$network,32) }
    inc %i
  }
  if ($prop == id) && ($1 != 0) { return $conid($1) }
  if ($1 = 0) && ($prop != list) return $scon(0)
  elseif ($1 isnum 1- $scon(0)) %n = $gettok(%n,$1,32)
  elseif ($1 != list) && ($prop != list) %n = ""
  return %n
}
alias conid {
  if ($network($1)) {
    var %x $scon(0)
    while (%x) {
      var %b $scon(%x)
      scid %b 
      var %n [ $+ [ %x ] ] $network
      if (%x == $1) return $cid
      dec %x
    }
    return %n3
  }
  else return $!null
}

Comments

Sign in to comment.
Jethro   -  Dec 24, 2009

C'mon dude, don't be dramatic. I wasn't implying that to you, but to gooshie who's been scripting for many years and he knows quite a bit in scripting. I basically pointed out that it's beneficial to learn from those who know something that you (or we) don't. There're lots to gain and nothing to lose.

P.S. I'm not trying to be sarcastic or competitive either. Experienced or not, I believe we're all learning...and it's a never-ending process.

 Respond  
DarkCoder   -  Dec 24, 2009

jethro_, thats rude, You say i am unexperienced because i dont know about 1 identifier? Last i recall you didnt know $tip very well.

 Respond  
Jethro   -  Dec 24, 2009

Me "two," It's always an advantageous experience to learn from the experienced.

 Respond  
KronicDreamer   -  Dec 23, 2009

yea i like gooshie's better :|

 Respond  
DarkCoder   -  Dec 17, 2009

fml :< $scon(n).cid, never heard of it til now.

 Respond  
gooshie   -  Dec 17, 2009

What's wrong with the built-in $scon(N).cid ???

I don't think you understand the way I wrote mine.
The 2nd network connection is NOT necessarily
the 2nd server connection.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.