All script codes that I publish here made and are pre-tested by me personally, therefore most often are working correct. If something doesn’t work for you, then 99,9% you did something wrong.
if (%str iswmcs %msg1) { ... }
iswm - returns true, if string with wildcards * in a variable
%str matches string in a variable
%msg1.
iswmcs - returns true, if string with wildcards * in a variable
%str matches (case sensitive) string in a variable
%msg1.
Information about comparison operators:
https://en.wikichip.org/wiki/mirc/operatorsInformation about switches in the read identifier:
https://en.wikichip.org/wiki/mirc/identifiers/$readSince you only wanted to get a 100% match, I used a more precise comparison operator "
iswmcs" so that even the case of letters in the text matches (with different height): "
А !=
а".
For example, a message: "
What is the capital of Germany?" - will not be the same as: "
what is the capital of germany?".
Therefore, if the letter case of the message on the channel differs from the case of letters in the text from the file, then you will not get any result.
If you do not need this, then can use a simpler code:
on *:TEXT:*:#:{
var %msg1 $strip($1-) | var %file QA.txt
if ($read(%file,-nw,%msg1)) {
var %num $readn | var %str $read(%file,-n,%num)
if (%str == %msg1) { msg $chan 04Line %num 12- there is a 99% match. }
}
}
Or even code like this:
on *:TEXT:*:#:{
var %msg1 $strip($1-) | var %file QA.txt
if ($read(%file,-nw,%msg1)) { msg $chan 04Line $readn 12- there is a 99% match. }
}
Or even easier:
on *:TEXT:*:#: if ($read(QA.txt,-nw,$1-)) msg $chan 04Line $readn 12- there is a 98% match.
Probably with this code variant there will be the most accurate text check:
on *:TEXT:*:#:{
var %msg $strip($1-) | var %file QA.txt
if ($read(%file,-nw,%msg)) {
var %num $readn | var %str $read(%file,-n,%num)
if (%str isincs %msg && $len(%str) == $len(%msg)) {
msg $chan 04Line %num 12- there is a 100% match.
}
}
}