mIRC Home    About    Download    Register    News    Help

Print Thread
#95346 24/08/04 04:20 AM
Joined: Apr 2004
Posts: 73
Z
Babel fish
OP Offline
Babel fish
Z
Joined: Apr 2004
Posts: 73
Hey everyone,
I think a feature like this would be very handy:

$getnick(Guest*,#,0)

This would return the amount of nicknames with the wildtext match of the first paramater. And, if 0 is replaced with a natural number, returns the Nth number matching that string. (duhhhhh).

-Zelda4ever
aka "The Big 'Z'"
-note- I am working on a workaround right now, but if u want to go ahead and make one for me, go ahead.


/tokenize 32 $gettok($1-,1-,32)
#95347 24/08/04 05:20 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Heavily commented, and heavily error checked, but works (or should. Tried in a server channelw ith ~150 people, looked for k*, found three (0). Then looped through, and found all names (even me! ;d). Tell me about any problems.

[ Copy below, open WordPad (Start->run "wordpad" -> ENTER), Paste. Re-select text, and copy, then paste into editor. ]
Code:
; $getnick(channel, nick/wildcard, N)
; channel - Channel where nickname list exists
; nick/wildcard - nickname or wildcard of the nicknames to be searched
; N - Nth nickname or 0 for matching count
alias getnick {
  ; default return
  var %return = $false

  ; name of alias (errors)
  var %alias = $ $+ getnick:

  ; make sure it's used as an identifier
  if ($isid) {

    ; correct channel name
    if ($1 !ischan) /echo -s * %alias Invalid channel $1

    ; specified search text
    else if (!$2) /echo -s * %alias Missing nickname/wildcard

    ; specified N
    else if ($3 !isnum) /echo -s * %alias Invalid Nth value

    ; look
    else {

      ; populate hash of nicks
      var %table = $+(getnick,$ticks), %n = $nick($1,0)
      /hmake %table 10
      while (%n > 0) {
        /hadd %table $nick($1,%n)
        /dec %n
      }

      ; set return match
      var %return = $hfind(%table,$2,$3,w)

      ; free it up
      /hfree %table
    }
  }
  else /echo -s * %alias Must be used as an identifier

  if (%return == $null) {
    /echo -s * %alias Invalid Nth value
    var %return = $false
  }

  return %return
}


-KingTomato
#95348 24/08/04 09:33 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
It's already possible: you can scan the nicklist with $fline() and scan the internal address list (IAL) with $ialchan()

For example,
  • //echo - $line(#, $fline(#, [color:blue]Guest*, 1, 1), 1)

    $line() is used in conjunction with $fline() to retrieve the nickname by its nicklist position. The last parameter of both identifiers, 1, indicates we're searching the side-listbox and not the main channel window.

    //echo - $ialchan(*!*@*.aol.com, #, 1)[/color]


Link Copied to Clipboard