/searchnick

By Ahmed Zaggoudi on Apr 26, 2011

[¤1-Description¤] :
You can with this snippet search nick in the channel . For example :
if you type /searchnick m the snippet gives you all nicknames who have the letter "M" in their nicks
This is my example from my mIRC xD
/searchnick m
-> Milarkovic
-> Webcam-M0nster
-> islamabadBoY
-> American^Pie
-> Fat3maa
-> X-Women-Power
-> Rose-lady-fem
-> Dementia
-> priya-da-ice-cream-head
-> Electric^Mayhem
-> _Ho-hum-wut-now
-> Gamble
-> ysalamiri
-> mashed
-> ImTheDuDe
-> SoBiYa^Malik
-> Hamil
-> staminus
-> Smiles
-> Macan
-> karima
-> MissDior
-> Miss_Power
-> Montana
Don't forget to use MASK ( nick )

;### /searchnick | Put in your remote :)
alias searchnick {
  who +cn # * $+ $1 $+ *
  set -u2 %searchnick $1
  .enable #searchnick
  echo $color(Info2) -a <- $+ $msgt(searchnick-list,$$1,$active) $+ :
}
#searchnick off
raw 352:*:{
  if ($check_serv) { haltdef }
  echo $color(info) -a -> $replace($6,%searchnick,04 $+ %searchnick $+ )
}
raw 315:*:{
  if ($check_serv) { haltdef }
  echo $color(info2) -a <- $msgt(end-list)
  .disable #searchnick
}
#searchnick end

Comments

Sign in to comment.
jaytea   -  Apr 26, 2011

only useful if we expect the user to search for nicknames including wildcards which should be treated literally. since nicknames, by and large, cannot contain '*' or '?', or be equal to '&', this isn't a worry.

 Respond  
Jethro   -  Apr 26, 2011

For a precise match, and I'm sure you already know, we can use text 3, which can apply regex match to the search...

 Respond  
jaytea   -  Apr 26, 2011

that's not the point. your example is misleading; you suggest '/searchnick m' which seems to imply that the wildcards around 'm' are necessary to check for 'm' at any position in a nickname, whereas '/searchnick m' has the same effect.

it isn't a good idea to enclose the search term in - what if a user specifically wanted to search for a substring at the beginning or end of a nickname?

 Respond  
Ahmed Zaggoudi   -  Apr 26, 2011

Jaytea : we use this snippet to checking for bad nicks

 Respond  
jaytea   -  Apr 26, 2011

silly, i think. what if the user wanted to search for nicknames beginning or ending with a certain tag, such as those matching '[CLAN]*'?

 Respond  
Ahmed Zaggoudi   -  Apr 26, 2011

yap Jethro, always your snippets are concise;
also your snippet gives nicknames in some lines, It's better than my snippet , like it

 Respond  
Jethro   -  Apr 26, 2011

AmytiX, it'd look a lot better to have the result displayed horizontally. The vertical display looks rather "floody." Borrowing from jaytea's concept, you can do this:

alias search {
  while ($fline(#,$+(*,$$1,*),$0,1).text) { tokenize 32 $1- $v1 }
  echo -ag $replace($2-,$chr(32),$chr(44) $chr(32))
}

Then the search will give you all the related nicknames in this fashion: nick1, nick2, nick3, nick4 etc...

The latest mIRC versions have the ability to chop up long text and split it into the next line, (it's enabled by default) so you don't have to worry about the search result being cut off.

The use of $fline() is by far the most efficient method to search nicknames on the nicklist.

 Respond  
Jethro   -  Apr 26, 2011

jaytea, the current code you have will have to search the whole, exact nickname to return a match. I think you may have forgotten to enclose $1 with the asterisk symbols:

alias search {
  var %t = 1
  while ($fline($chan, * $+ $1*, %t, 1).text) {
    echo -ag -> $v1
    inc %t
  }
}
 Respond  
jaytea   -  Apr 26, 2011

i wouldn't say it's complicated, just wasteful since it relies upon a response from the server containing data that is already computable given the information stored by the client (the pertinent data at least).

you should be using 'iswm' instead of 'isin' for it to be functionally similar to the original code. also, you may use $fline() to find nicknames that match a certain wildcarded pattern in a given channel. for example:

var %t = 1
while ($fline($chan, $1, %t, 1).text) {
  echo -ag -> $v1
  inc %t
}
 Respond  
Scakk   -  Apr 26, 2011

This seems more complicated than it needs to be.

A shorter version below so you can understand my comment above.

alias searchnick { 
  var %t 1 | while (%t <= $nick($chan,0)) { 
    if ($1 isin $nick($chan,%t)) { var %snick $addtok(%snick,$nick($chan,%t),32) }
    inc %t
  }
  $iif($isid,return,echo -ag) %snick
}

Or if you wish to keep it one name per line.

alias searchnick { 
  var %t 1 | while (%t <= $nick($chan,0)) { 
    if ($1 isin $nick($chan,%t)) { echo -ag -> $v2 }
    inc %t
  }
}
 Respond  
Memoli   -  Apr 26, 2011

/searchnick m

  • No such identifier: $msgt (line 14, TEST.ini)
 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.