Network's and chans

By GrimReaper on Nov 18, 2010

This is kind of a spammy script.. But it will show you the Network's connected to with Nicks, Server's, Channels and if you are away. and will hide all channels with +s/+p/+O/+A in channel modes

Syntax:

/nets n (Show's just Network name and your nick) /nets c (Show's Network Name, Channels and your nick) /nets a (Show's network name, your nick and if you're marked away on the network) /nets s (Show's Network name, your nick and the server you are connected too)

UPDATE: I have added /nets o into the script as well.. Just show's what Oline status you have on each network or "No IRC Status" if it's null.

alias nets {
  if ($$1 == n) {
    var %ctr = 0 | var %tot = $scon(0)
    while (%ctr < %tot) {
      inc %ctr | msg $active 12[15Connected To12]15: $scon(%ctr).network 12[15As12]15:4 $scon(%ctr).me
    }
  }
  elseif ($$1 == c) {
    var %ctr = 0 | var %tot = $scon(0)
    while (%ctr < %tot) {
      inc %ctr | msg $active 12[15Connected To12]15: $scon(%ctr).network 12[15In12]15: $scon(%ctr).chanz 12[15As12]15: $scon(%ctr).me
    }
  }
  elseif ($$1 == a) {
    var %ctr = 0 | var %tot = $scon(0)
    while (%ctr < %tot) {
      inc %ctr | msg $active 12[15Connected To12]15: $scon(%ctr).network 12[15As12]15: $scon(%ctr).me 12[15And Marked As12]15: $iif($scon(%ctr).away == $true,Away,Here)
    }
  }
  elseif ($$1 == S) {
    var %ctr = 0 | var %tot = $scon(0)
    while (%ctr < %tot) {
      inc %ctr | msg $active 12[15Connected To12]15: $scon(%ctr).server 12[15As12]15: $scon(%ctr).me
    }
  }
  elseif ($$1 == o) {
    var %ctr = 0 | var %tot = $scon(0)
    while (%ctr < %tot) {
      inc %ctr | msg $active 12[15Connected To12]15: $scon(%ctr).network 12[15As12]15: $scon(%ctr).me 12[15Oline Status12]15: $scon(%ctr).oline
    }
  }
}

alias -l chanz {
  var %channelcounter = 1
  while (%channelcounter <= $chan(0)) { 
    if (s isincs $chan(%channelcounter).mode) || (O isincs $chan(%channelcounter).mode) || (A isincs $chan(%channelcounter).mode) || (p isincs $chan(%channelcounter).mode) { inc %channelcounter 1 }
    else { var %channeltotal = %channeltotal $iif($istok(~|&|@|%|+,$left($nick($chan(%channelcounter),$me).pnick,1),124),$left($nick($chan(%channelcounter),$me).pnick,1) $+ $chan(%channelcounter) $+ $chr(32),$chan(%channelcounter) $+ $chr(32)) | inc %channelcounter 1 }
  }
  return %channeltotal
}

alias -l oline {
  if (N isincs $usermode) { return Network Admin. | HALT }
  if (A isincs $usermode) { return Server Admin. | HALT }
  if (a isincs $usermode) { return Services Admin. | HALT }
  if (O isincs $usermode) { return Local IRC Operator. | HALT }
  if (o isincs $usermode) { return Global IRC Operator. | HALT }
  if (!$istokcs(N|A|a|O|o,$usermode,124)) { return No IRC Status. | HALT }
}
Sign in to comment.
Gummo   -  Nov 21, 2010

I don't know how $istokcs could have worked for you, Jethro_. You're checking to see if ALL modes in a room match ONE mode. +si does not match 's'. $istokcs(s,si,32)

 Respond  
Jethro   -  Nov 19, 2010

You're probably right, Jaytea. :p But upon testing it with $istokcs, it works as what the initial code does.

The countcs is rather wildcard based, meaning if I have other modes followed before or after the mode I'm after, it'll trigger.

 Respond  
jaytea   -  Nov 19, 2010

$istokcs(A B C, $X, 32) checks if ($X === A) || ($X === B) || ($X === C), that's not the same as what he has. what he has is this:

if ($countcs($chan(%channelcounter).mode, s, O, A, p)) {

try to use $gettok($chan( ).mode, 1, 32) wherever you can, $chan( ).mode can include things like channel keys which may contain the modes you're checking for :P

 Respond  
Jethro   -  Nov 18, 2010

For the chanz alias, if you already know about the $istok(), why not take advantage of the $istokcs(), the case sensitive version for this line:> if (s isincs $chan(%channelcounter).mode) || (O isincs $chan(%channelcounter).mode) || (A isincs $chan(%channelcounter).mode) || (p isincs $chan(%channelcounter).mode) {It can be shortened to this:

if ($istokcs(s O A p,$chan(%channelcounter).mode,32)) {
 Respond  
Jethro   -  Nov 18, 2010

Why did you make several while loops when one will do:

alias nets {
  var %ctr = 0, %tot = $scon(0)
  while (%ctr < %tot) {
    inc %ctr
  }
  if ($$1 == n) {
    msg $active 3*14 7Connected To:4 $scon(%ctr).network 7As:4 $scon(%ctr).me $+ 
  }
  elseif ($$1 == c) {
    msg $active 3*14 7Connected To:4 $scon(%ctr).network 8( $+ 7In14 $scon(%ctr).chanz $+ 8) 7As:4 $scon(%ctr).me $+ 
  }
  elseif ($$1 == a) {
    msg $active 3*14 7Connected To:4 $scon(%ctr).network 7As:4 $scon(%ctr).me 7and marked as:4 $iif($scon(%ctr).away == $true,Away,$iif($scon(%ctr).away == $false,Here))  $+ 
  }
  elseif ($$1 == S) { 
    msg $active 3*14 7Connected To:4 $scon(%ctr).server 7As:4 $scon(%ctr).me $+ 
  }
}

Saves you 248 bytes, excluding the chanz alias.

 Respond  
Cados   -  Nov 18, 2010

Yeah, I just changed it to an echo. 8/10

 Respond  
GrimReaper   -  Nov 18, 2010

Thanks. :)

As I said, It is a little bit of a spammer.. but use it wisely. as some network's may /not/ like the spam. lol

 Respond  
Cados   -  Nov 18, 2010

Ah, forgot most are in +ps...great snippet! :D

 Respond  
GrimReaper   -  Nov 18, 2010

@Cados, All channel's that your in on each network minus the one's that are +O, +A, +s or +p

 Respond  
Cados   -  Nov 18, 2010

Is it supposed to show all channels or one?

 Respond  
PuNkTuReD   -  Nov 18, 2010

i wanna see..... my nick... network... server i am connected to... if i am away.... and channels....

pretty please...

 Respond  
PuNkTuReD   -  Nov 18, 2010

yea... soda always does it....

 Respond  
GrimReaper   -  Nov 18, 2010

Newp! :D Am sane! well.. Kinda o.o I've been drinking Dr. Pepper.. so that could explain it XD

 Respond  
PuNkTuReD   -  Nov 18, 2010

your high right?

 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.