$nicks

By brinxy on Nov 19, 2007

$nicks complies a list of nicks based on the params you specify. Much more detailed explanation in code.

/* 
** $nicks by brinxy **
** ------------------ **
** About **
** ----- **
** $nicks first compiles a list of all nicks in the channel. **
** This list is made based off of the paramaters in the prop. **
** Bascially an enhancement to $nick, which can ony handle one nick at a time **
** Syntax **
** ------ **
** $nicks(#channelname,N,N*)[.prop] **
**  -N* means you can use multiple params in the identifier
**  -.prop will be explained further
** Properties ** 
** ---------- **
** [.prop], as mentioned above, can be one of the following:
**  - .pnick compiles the list including the .pnick as used in the $nick identifier; returning (~&@%+) 
**  - .aohvr complies the list based on $nick's aohvr properties.
** Examples **
** -------- **
** Let's say I Was on the channel #mirc with three nicks. The first nick named Nick1 as an op, the second nick Named Nick2 with a voice, and the third nick named Nick3 with just regular status.
**  - $nicks(#mirc,1,32).o would return Nick1 because Nick1 is the only nick with an op, thus being the only nick in the list.
**  - $nicks(#mirc,1,2,32).pnick would return @Nick1 and %Nick2 (assuming these are the only supported prefixes on the server) 
**  - $nicks(#mirc,1,3,32) would just return Nick1 Nick2 Nick3 because there are no special params. 
*/

alias nicks { 
  if ( $me ison $1 ) { 
    var  %ret, %x = 2
    while (%x <= $0) { 
      var %t = $($+($,%x),2)
      if ( !$regex(%t,/^[0-9]+$/gi) ) break
      elseif ( !$nick($1,%t) ) break
      else { 
        if ( $prop = pnick ) %ret = %ret $iif($left($nick($1,%t).pnick,1) != $left($nick($1,%t),1),$+($left($nick($1,%t).pnick,1),$nick($1,%t)),$nick($1,%t))
        elseif ( $prop isin aohvr ) %ret = %ret $nick($1,%t,$prop)
        else %ret = %ret $nick($1, %t)
      }
      inc %x
    }
    return %ret
  }
}

Comments

Sign in to comment.
Pangaea   -  Mar 29, 2012

hi brinxy, is there anyway to use this to write a list of nicks to a text file,, then if written to again delete the previous text or text file so it wont add nicks.

Im running a multiserver relay script and i want users from one chan on serverA to be able to for example !nicksB then get a list of all nicks in the other chan on serverB noticed to them. The trouble is both chans on either side of the relay have the same channel name.
Can you think of a way this is possible?

so if someone from #chan on serverA types !nicksB, bot will check and write list of all nicks from #chan on serverB into bnicks.txt .. then will notice bnicks.txt to that person.

If someone from #chan on serverB types !nicksA, not will check and write list of all nicks from #chan on serverA into anicks.tct then subsequently notice the person.

Is this even possible since the 2 chans are named the same? will it list all nicks in both chans, or only in the target chan of the command.

any thoughts/advice?

regards
pan

 Respond  
brinxy   -  Nov 22, 2007

I think I\'m going to stick with this method. But thanks for your suggestions. ^_^

 Respond  
Lindrian   -  Nov 20, 2007

Max lenght of a variable is usually around 900 ($len() wise).
So you could simply limit it to 900, and if it reaches 900 ull add a message that its full or so. OR!
You can use a hash table (Dont know what the limit is, but obviously easier to deal with when it comes to several ID\'s).
If none of thats good enough, you can use dyanmic variables, which you\'ll loop twice.

First you add the items in variable, if it reaches 900, u use variable.1, and so on, and add the id\'s in another variable
so in the end u might have

%variable.1
%variable.2
%variable.3

%variable.all 3

That way you\'ll know, \"aha, there\'s 3 dyanmic vars\" and then echo the info.

Ill let u figure it out urself ;)

 Respond  
brinxy   -  Nov 20, 2007

Found out that doesn\'t work either. For now, I decided to put the original back up until further notice. If you receive any errors with this please let me know.

 Respond  
brinxy   -  Nov 20, 2007

Mmm. I forgot about large channels. Heheh. I\'ll look into binvars, as I do not know much about them. Just curious, if I completely removed $addtok and just used %ret = %ret etc, would that remove the error?

 Respond  
Lindrian   -  Nov 20, 2007

Hehe,

  • /set: line too long (line 8, test.mrc)
    Knew that would happend. There\'s a way to fix it, but you\'ll have to recode or use binvars.
 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.