-1

I'm having an issue with my current code.

on *:TEXT:*text*:#:{ 
  if ($nick isin $read(test.txt, 1)) {
    msg $chan working.
  }
}

The issue I am having is if the nick "User1" is in test.txt, and "User12" types text, It will detect it as User1 was in test.txt! How can I make it so "User12" will not say working if "User1" is on line 1.

skdfsfwse
  • 19
  • 7

2 Answers2

2

You problem is that User1 contains in the first line User12 and you're searching by isin.

You can use regex $+(\b,$nick,\b) with \b word boundary for for making sure there is not text before or after the searched $nick

on *:TEXT:*text*:#:{ 
  var %line = $read(test.txt, 1)
  if ($regex(%line, $+(\b,$nick,\b))) {
    msg $chan working.
  }
}
Orel Eraki
  • 11,940
  • 3
  • 28
  • 36
2

Another way to make it works, is using identifier $istok...

on *:TEXT:*text*:#:{ 
if ($istok($nick,$read(test.txt,1),32)) {
msg $chan working.
}
}

Since it will only search for a specific token at the specific string... $istok identifier will do the same match as \b****\b Regex Boundary

Sirius_Black
  • 471
  • 3
  • 11