|
Search each line in txt file for a match.
#249362
26/11/14 01:45 PM
|
Joined: Nov 2014
Posts: 8
RyuFive
OP
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Nov 2014
Posts: 8 |
A similar post was made in the past: http://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
|
|
|
Re: Search each line in txt file for a match.
[Re: RyuFive]
#249363
26/11/14 01:53 PM
|
Joined: Dec 2013
Posts: 779
Nillen
Hoopy frood
|
Hoopy frood
Joined: Dec 2013
Posts: 779 |
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?
Nillens @ irc.twitch.tv Nillen @ irc.rizon.net
|
|
|
Re: Search each line in txt file for a match.
[Re: Nillen]
#249365
26/11/14 02:04 PM
|
Joined: Nov 2014
Posts: 8
RyuFive
OP
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Nov 2014
Posts: 8 |
var %whom if (%whom isin list.txt) { say something } %whom is something like User123 list has names in seperate lines like: User120
User121
User123
User124
User125
Last edited by RyuFive; 26/11/14 02:07 PM.
|
|
|
Re: Search each line in txt file for a match.
[Re: RyuFive]
#249366
26/11/14 02:12 PM
|
Joined: Dec 2013
Posts: 779
Nillen
Hoopy frood
|
Hoopy frood
Joined: Dec 2013
Posts: 779 |
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
Nillens @ irc.twitch.tv Nillen @ irc.rizon.net
|
|
|
Re: Search each line in txt file for a match.
[Re: Nillen]
#249367
26/11/14 03:10 PM
|
Joined: Nov 2014
Posts: 8
RyuFive
OP
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Nov 2014
Posts: 8 |
%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
Last edited by RyuFive; 26/11/14 03:10 PM.
|
|
|
Re: Search each line in txt file for a match.
[Re: RyuFive]
#249368
26/11/14 03:16 PM
|
Joined: Dec 2013
Posts: 779
Nillen
Hoopy frood
|
Hoopy frood
Joined: Dec 2013
Posts: 779 |
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.
Nillens @ irc.twitch.tv Nillen @ irc.rizon.net
|
|
|
Re: Search each line in txt file for a match.
[Re: Nillen]
#249369
26/11/14 03:19 PM
|
Joined: Nov 2014
Posts: 8
RyuFive
OP
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Nov 2014
Posts: 8 |
the token was: target='_blank'>Sokynu<\/a>
var %whom = $left($right($gettok(%x,%j,32),-16),-7)
|
|
|
Re: Search each line in txt file for a match.
[Re: RyuFive]
#249371
26/11/14 04:17 PM
|
Joined: Dec 2008
Posts: 1,511
westor
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,511 |
Try $gettok : /help $gettok $gettok($gettok(target='_blank'>Sokynu<\/a>,2,62),1,60)
|
|
|
Re: Search each line in txt file for a match.
[Re: RyuFive]
#249372
26/11/14 05:05 PM
|
Joined: Jul 2006
Posts: 3,740
Wims
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 3,740 |
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. if ($read(list.txt, wn, %whom)) { var %log = %log $+ %who hospitalized %whom $+ ! }
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
|
|
|
Re: Search each line in txt file for a match.
[Re: Wims]
#249381
26/11/14 08:06 PM
|
Joined: Nov 2014
Posts: 8
RyuFive
OP
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Nov 2014
Posts: 8 |
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. 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. if ($read(faction_list.txt,sn,%whom) == 1) {
var %log = %log $+ 3 $+ %who hospitalized 7 $+ %whom $+ 3! (10HYF3)
}
|
|
|
Re: Search each line in txt file for a match.
[Re: RyuFive]
#249399
27/11/14 07:18 PM
|
Joined: Nov 2014
Posts: 8
RyuFive
OP
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Nov 2014
Posts: 8 |
got rid of the 1 since that was annoying. 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
|
|
|
|
|
|