Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

TAB nickname finder

Recommended Posts

  • Administrators
>TAB nickname finder

============================

on *:tabcomp:#:{

 var %# = $chan

 if ($gettok($1-,$tabtok,32) ison %#) {

   window -dhkln +L @Nicks $calc($window(%#).dx + 4) $calc(($window(%#).dy + $window(%#).dh) - 77) 200 100

   var %x = 1

   while ($nick(%#,%x)) {

     var %n = $v1, %m = $+($gettok($tabline,$tabtok,32),*)

     if ((%m iswm $remove(%n,`,^,-,_,[,],$chr(123),$chr(125),|,\)) || (%m iswm %n)) {

       var %i = $remove($ifmatch,*), %p = $pos(%n,%i,1), %c = $iif($gettok($tabline,$tabtok,32) == *,%n,$+($left(%n,$calc(%p - 1)),,$mid(%n,%p,$len(%i)),,$mid(%n,$calc(%p + $len(%i))))), %y = 1

       while ($nick(%#,%n).idle >= $nick(%#,$strip($line(@nicks,%y))).idle) inc %y 1

       iline @nicks %y %c

     }

     inc %x 1

   }

   titlebar @nicks $line(@nicks,0)

   complete 1

   if ($line(@nicks,0) > 1) window -a @nicks

   else tabclose

   halt

 }

}

menu @nicks {

 lbclick:complete $1

 dclick:tabclose

}

on *:active:*:if (($window(@nicks)) && ($active != @nicks)) tabclose

on *:keydown:@nicks:*:{

 var %k = $keyval

 if (%k == 9) {

   var %l = $sline(@nicks,1).ln, %n = $iif($line(@nicks,0) == %l,1,$calc(%l + 1))

   complete %n

 }

 elseif ((%k == 8) || (%k == 27)) highlight

 elseif (%k == 13) return

 elseif ($keychar) {

   if ((%k == 186) || (%k == 188) || (%k == 190) || (%k == 191) || (%k == 222)) var %n = $keychar

   var %p = $calc($len($gettok($tabline,$+(1-,$tabtok),32)) + 3)

   editbox $+(-b,%p,e,%p,$iif(%k == 32,p)) $tabwin $iif(%n,$puttok($tabline,$+($gettok($tabline,$tabtok,32),%n),$tabtok,32),$instok($tabline,$keychar,$calc($tabtok + 1),32))

   tabclose

 }

}

on *:close:@nicks:highlight

alias -l tabtok return $numtok($left($tabline,$editbox($tabwin).selstart),32)

alias -l tabwin return $iif($active == @nicks,$lactive,$v1)

alias -l tabline return $editbox($tabwin)

alias -l tabclose window -c @nicks

alias -l complete {

 sline @nicks $1

 var %p = $calc($len($gettok($tabline,$+(1-,$calc($tabtok - 1)),32)) + $len($line(@nicks,$1)))

 editbox $+(-b,%p,e,%p) $tabwin $puttok($tabline,$strip($line(@nicks,$1)),$tabtok,32)

}

alias -l highlight {

 var %l = $tabline, %t = $tabtok

 editbox $+(-b,$calc(($len($gettok(%l,$+(1-,%t),32)) - $len($gettok(%l,%t,32))) + 1),e,$calc($len($gettok(%l,$+(1-,%t),32)) + 1))) $tabwin %l

 tabclose

}

Link to comment
Share on other sites



×
×
  • Create New...