mIRC Homepage
Posted By: XGamerAMD on text question - 06/10/22 11:27 PM
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
Posted By: maroon Re: on text question - 07/10/22 01:15 AM
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
}
Posted By: XGamerAMD Re: on text question - 07/10/22 09:27 AM
thnx great maroon
© mIRC Discussion Forums