mIRC Home    About    Download    Register    News    Help

Print Thread
#180737 13/07/07 12:51 PM
Joined: Jun 2007
Posts: 37
E
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Jun 2007
Posts: 37
Hi, I want it so thats when I say "nick: blah blah" it will come up as "~nick~ blah blah" ... and when I say "blah blah nick yadda yadda" it will show up as "blah blah ~nick~ yadda yadda"

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
on *:INPUT:#: {
  if (/* !iswm $1) {
    var %i = 1
    while ($nick($chan,%i)) {
      if ($replace($1,:,*) iswm $nick($chan,%i)) {
        msg $chan $+(~,$nick($chan,%i),~) $2-
        halt
      }
      elseif ($replace($1,:,*) !iswm $nick($chan,%i)) {
        msg $chan $replace($1-,$nick($chan,%i),$+(~,$nick($chan,%i),~))
        halt
      }
      inc %i
    }
  }
}


I just modified fubar's code slightly from here.

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
1. You really want to use $fline instead of a while loop/iswm: it makes a big difference speed-wise in large channels.

2. I don't see why you use
Code:
if (a iswm b) { .. }
elseif (a !iswm b) { ... }
instead of
Code:
if (a iswm b) { ... }
else { ... }
No reason to make the script slower by checking the same condition twice.

3. I assume the "elseif" part is meant to decorate any nicks in $1- with ~'s, however it's not correct: it will only decorate any occurrences in $1- of the first nick in the channel (assuming $1 doesn't match) and then stop.

4. Using $replace to replace all occurrences of a nick in $1- will likely lead to problems with short/common nicks. Consider what would happen with a nick like "hi" or "att": words like "this", "him" or "attention", "pattern" etc would be messed up.

5. If my assumption in #3 is correct, you do need a loop, but not through the nicklist; rather through the words in $1-, checking if ($N ison #)


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Jun 2007
Posts: 37
E
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Jun 2007
Posts: 37
Code:
elseif ($replace($1,:,*) !iswm $nick($chan,%i)) {
        msg $chan $replace($1-,$nick($chan,%i),$+(~,$nick($chan,%i),~))
        halt
      }
      inc %i
    }
  }
}



Only works when I type my own nick.


Link Copied to Clipboard