mIRC Home    About    Download    Register    News    Help

Print Thread
#270823 06/10/22 11:27 PM
Joined: Apr 2005
Posts: 111
X
Vogon poet
OP Offline
Vogon poet
X
Joined: Apr 2005
Posts: 111
on *:text:*:#:{
if !$window(@mencion) { /window -lke +b @mencion 400 600 1200 400 }
set %texto $1- | set %menchan $chan
if ($1 isin %lista) { /msg verdugo $1- # $nick $time }
elseif ($1 == $Me ) { .echo -- cc }
}
i add %lista set %Lista $addtok(%lista,$1,44)

the words are venta,flores,infantil
how i do to check this?

tjx

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
It's possible to do this more efficiently with regex or hashtables, especially if your list of items grows. Those would allow comparing all of your keywords against $1- at the same time, instead of checking them 1 at a time. But this simpler code is easier to understand.

I'm leaving alone part of what you have in there, even though they're not doing anything. You create global variables %menchan and %texto but don't do anything with them. And the way you're using echo shows that text to the status window. Because your list of keywords is separated by commas, you can have unexpected results if you allows spaces in the list


Code
ON *:text:*:#:{
  set %menchan $chan
  set %texto $1-
  if (!$window(@mencion)) { /window -lke +b @mencion 400 600 1200 400 }
  var %i 1
  while ($gettok(%lista,%i,44)) {
    if ($v1 isin $1-) goto match
    inc %i
  }
  if ($1 == $me ) { .echo -- cc }
  return
  :match
  msg verdugo $1- # $nick $time matched the word $v1
}

maroon #270828 07/10/22 09:27 AM
Joined: Apr 2005
Posts: 111
X
Vogon poet
OP Offline
Vogon poet
X
Joined: Apr 2005
Posts: 111
thnx great maroon


Link Copied to Clipboard