Tab Nick Completer

By blessing on Apr 18, 2014

This script replaces default tab nick completer.

It works on channel and chat window.
The nick can be customized, so you can put color, bold, underline or give some style to it like nick [~~] etc

You can edit var %f1 and %f2 to suit your style.
var %f1 is nick on first word in editbox
var %f2 is nick on anywhere after %f1

I hope it works as expected.

on *:tabcomp:*:{
  ; edit %f1 & %f2 to suit your style.
  var %f1 nick:
  var %f2 *nick*

  var %t $target, %eb $1-, %nt $numtok(%eb,32), %f $iif(%nt > 1,%f2,%f1), %a 1
  while %a < $len(%f) {
    if $mid(%f,%a,4) == nick { dec %a | break }
    inc %a
  }
  var %aa $iif(%a,$mid(%f,1,%a)), %bb $mid(%f,$calc(%a + 5))
  var %et $gettok(%eb,1 - $calc(%nt - 1),32), %e $gettok(%eb,-1,32)
  var %ee $iif($remove(%e,%aa,%bb) == %nc.nick,%nc.nick,%e)
  var %p $iif($remove(%e,%aa,%bb) == %nc.nick,%nc.pos,$calc($editbox(%t).selstart - 1 - $iif(%nt > 1,$calc($len(%et) + 1),0))) 
  var %i $calc($nick(%t,%ee) + $iif($left(%nc.nick,%p) == $left(%ee,%p) && %nc.pos == %p,1,0))
  if %t ischan {
    var %n $nick(%t,$nc(%t,%i,%p,%ee))
    if !%n { var %n $nick(%t,$nc(%t,1,%p,%ee)) }
  }
  else { var %n $iif($+($mid(%ee,1,%p),*) iswm %t,%t) }
  if %n {
    haltdef
    var %lt $+(%aa,%n,%bb), %text $iif(%nt > 1,$+(%et,$chr(32),%lt),%lt)
    editbox -ap %text
    set -e %nc.pos %p
    set -e %nc.nick %n
  }    
}

alias -l nc {
  var %t $1, %i $2, %p $3, %ee $4, %b 1
  while $nick(%t,%i) {
    var %n $v1 
    if $+($mid(%ee,1,%p),*) iswm %n { var %b 0 | break }
    inc %i
  }
  return $calc(%i + %b) 
}

Comments

Sign in to comment.
meow81   -  May 18, 2021

Hi, It doesn't work as intended in the new version of mirc 7.65 , can you check ? I guess it needs a little modify ,
In a channel where there are more nicks with the first letter of a nick, if you try to turn all nicks available with tab key, it writes the following nick (in the nick list) thereafter instead of propose the others nick to choose and then it applies the Style and writes a following nick if you continue to press Tab. Please fix.

 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.