Difference between revisions of "How do I voice people with a specific clantag"

From Scriptwiki
Jump to: navigation, search
m (added author-tag)
(added some more internal links)
Line 11: Line 11:
  
 
So, to match clantags against a joining nick or similar we would in most cases need the * in the text we want to compare with [[$nick]]. If we want something to happen (eg. the voice) if the persons nickname starts with JUL, we would use the 'iswm' feature like this:
 
So, to match clantags against a joining nick or similar we would in most cases need the * in the text we want to compare with [[$nick]]. If we want something to happen (eg. the voice) if the persons nickname starts with JUL, we would use the 'iswm' feature like this:
  [[If-Then-Else|if]] (JUL* iswm $nick) { [[mode]] $chan +v $nick }
+
  [[If-Then-Else|if]] (JUL* iswm $nick) { [[mode]] [[$chan]] +v $nick }
  
 
This would voice people with JUL infront of their nick. But wait a second, we forgot the actual event, where this voicing should take place.
 
This would voice people with JUL infront of their nick. But wait a second, we forgot the actual event, where this voicing should take place.
Line 30: Line 30:
 
  ;If they change away from [9]FAN|, they'll get devoiced.
 
  ;If they change away from [9]FAN|, they'll get devoiced.
 
   
 
   
  [[Aliases|alias]] v_c { return #Channel }
+
  [[Aliases|alias]] v_c { [[return]] #Channel }
 
  ;Change #Channel  ^^ to what channel it should happen in.
 
  ;Change #Channel  ^^ to what channel it should happen in.
 
   
 
   
  alias v_n { [[return]] [9]FAN|* }
+
  alias v_n { return [9]FAN|* }
 
  ;Change [9]FAN|*      ^^ to what should be matched with NICK to get voice
 
  ;Change [9]FAN|*      ^^ to what should be matched with NICK to get voice
 
   
 
   
  on *:NICK:{
+
  [[On_nick|on *:NICK]]:{
   if ($v_n iswm $newnick) && ($newnick ison $v_c) {
+
   if ($v_n iswm [[On_nick|$newnick]]) && ($newnick ison $v_c) {
 
     mode $v_c +v $newnick
 
     mode $v_c +v $newnick
 
   }
 
   }
   elseif ($v_n iswm $nick) && ($v_n !iswm $newnick) && ($newnick ison $v_c) {
+
   [[If-Then-Else|elseif]] ($v_n iswm $nick) && ($v_n !iswm $newnick) && ($newnick ison $v_c) {
 
     mode $v_c -v $newnick
 
     mode $v_c -v $newnick
 
   }
 
   }

Revision as of 14:11, 5 September 2005

Every once now and then, people want to auto-voice people with a certain word or character in their nicknames. To make this happen we need to monitor several events since the nicks we would like to voice can come both on nickchanges and of course on joins. As a help to find out if a new nick in the channel has the clantag we want to voice, mIRC has a great feature called 'iswm'. It can match things up against eachother with wildcards. Wildcards can be in the form of * ? or & -

* matches any text
& matches any word
text matches if text contains only this word
text* matches if text starts with this word
*text matches if text ends with this word
*text* matches if text contains this word anywhere
? matches any letter (only one)
t?xt matches if we have a word where the ? can be a space, an e, anything!

So, to match clantags against a joining nick or similar we would in most cases need the * in the text we want to compare with $nick. If we want something to happen (eg. the voice) if the persons nickname starts with JUL, we would use the 'iswm' feature like this:

if (JUL* iswm $nick) { mode $chan +v $nick }

This would voice people with JUL infront of their nick. But wait a second, we forgot the actual event, where this voicing should take place.

on *:JOIN:#channel:{
  if (JUL* iswm $nick) { mode $chan +v $nick }
}

In the example above you (or the one with the snippet in his/her/its remote) would voice anyone joining #channel which nick starts with JUL. If we wanted the nick to end on JUL we would use:

if (*JUL iswm $nick) { mode $chan +v $nick }

If we wanted to voice if JUL occures ANYWHERE inside $nick use:

if (*JUL* iswm $nick) { mode $chan +v $nick }

This way you have almost unlimited ways of checking if the one joining your channel should be voiced. If the 'iswm' match isn't possitive (if $nick don't have JUL in his/her/its nick) nothing will happen.

;With the values set now, it sets +v if someone join and their nick starts with [9]FAN|.
;If they change nick to something which starts with [9]FAN|, they get voiced aswell.
;If they change away from [9]FAN|, they'll get devoiced.

alias v_c { return #Channel }
;Change #Channel   ^^ to what channel it should happen in.

alias v_n { return [9]FAN|* }
;Change [9]FAN|*       ^^ to what should be matched with NICK to get voice

on *:NICK:{
  if ($v_n iswm $newnick) && ($newnick ison $v_c) {
    mode $v_c +v $newnick
  }
  elseif ($v_n iswm $nick) && ($v_n !iswm $newnick) && ($newnick ison $v_c) {
    mode $v_c -v $newnick
  }
}
on *:JOIN:#:{
  if ($chan == $v_c) && ($v_n iswm $nick) {
    mode $v_c +v $nick
  }
}
Contributed by Zyberdog