mIRC Homepage
Posted By: RyuFive Search each line in txt file for a match. - 26/11/14 01:45 PM
A similar post was made in the past:
https://forums.mirc.com/ubbthreads.php/topics/246797/Re:_Search_each_line_in_txt_fi

I have a text file with names on each line, if i paste a lot of lines words into mirc, i want the bot to match each token against each name. then paste all the names that were matched as many times as matched.

I dont know what command we would use for this. Also a rough draft would be appreicated
Posted By: Nillen Re: Search each line in txt file for a match. - 26/11/14 01:53 PM
I'm the one who would like to have a rough draft... You want YOUR text to be matched against the text file's content? Do you want this to be actual on input or just as an alias that you can check yourself? If it's on input, do you want to limit it to a minimum token amount, etc, etc?

Can you provide an example of how you would like to type it and what should happen?
var %whom
if (%whom isin list.txt) {
say something
}

%whom is something like User123
list has names in seperate lines like:
Code:
User120
User121
User123
User124
User125
Posted By: Nillen Re: Search each line in txt file for a match. - 26/11/14 02:12 PM
You say "var %whom" which doesn't mean anything. Is %whom supposed to be set when you type something in a channel? like example:

RyuFive: Did Nillen talk to Budo today?

Should this match Nillen (1 time(s)) and Budo (1 time(s))?
Assuming that both Nillen and Budo are written in the list.txt
%whom is a name

if ($read(list.txt, sn, %whom)) {
var %log = %log $+ %who hospitalized %whom $+ !
}

This is what i have right now

Yet its not working
Posted By: Nillen Re: Search each line in txt file for a match. - 26/11/14 03:16 PM
How does %whom get set, that's all I want to know.

"var %whom" obviously won't work, you can try doing "echo -a Whom: %whom" afterwards and you'll see for yourself. You need to make the variable %whom a value before you can search for it.
the token was: target='_blank'>Sokynu<\/a>

var %whom = $left($right($gettok(%x,%j,32),-16),-7)
Posted By: westor Re: Search each line in txt file for a match. - 26/11/14 04:17 PM
Try $gettok :

/help $gettok

Code:
$gettok($gettok(target='_blank'>Sokynu<\/a>,2,62),1,60)
Posted By: Wims Re: Search each line in txt file for a match. - 26/11/14 05:05 PM
Quote:
if ($read(list.txt, sn, %whom)) {
var %log = %log $+ %who hospitalized %whom $+ !
}
Is an idea, but $read when used with the 's' switch will return the REST of the line, if your text file only has the name on it, that $read will find it, but will return $null, you should use the 'w' switch.

Quote:
if ($read(list.txt, wn, %whom)) {
var %log = %log $+ %who hospitalized %whom $+ !
}
Originally Posted By: Wims
Quote:
if ($read(list.txt, sn, %whom)) {
var %log = %log $+ %who hospitalized %whom $+ !
}
Is an idea, but $read when used with the 's' switch will return the REST of the line, if your text file only has the name on it, that $read will find it, but will return $null, you should use the 'w' switch.

Quote:
if ($read(list.txt, wn, %whom)) {
var %log = %log $+ %who hospitalized %whom $+ !
}


BRILLIANT!

Id gotten around this myself. I added 1 after every Nick in the list.
Code:
      if ($read(faction_list.txt,sn,%whom) == 1) {
        var %log = %log $+ 3 $+ %who hospitalized 7 $+ %whom $+ 3! (10HYF3)
      }
got rid of the 1 since that was annoying.

Code:
var %whom = dinkyd
      tokenize 32 %whom
      var %whom = $read(faction_list.txt,w,$1*)
      if ($len(%whom) >= 1) {
        var %log = %log $+ Someone hospitalized $+ %whom $+ !


If you have any suggestion id love to hear them, also this doesnt look very neat xD
© mIRC Discussion Forums