mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2014
Posts: 8
R
RyuFive Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Nov 2014
Posts: 8
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

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
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
Joined: Nov 2014
Posts: 8
R
RyuFive Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
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:
Code:
User120
User121
User123
User124
User125

Last edited by RyuFive; 26/11/14 02:07 PM.
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
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
Joined: Nov 2014
Posts: 8
R
RyuFive Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
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.
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
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
Joined: Nov 2014
Posts: 8
R
RyuFive Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Nov 2014
Posts: 8
the token was: target='_blank'>Sokynu<\/a>

var %whom = $left($right($gettok(%x,%j,32),-16),-7)

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Try $gettok :

/help $gettok

Code:
$gettok($gettok(target='_blank'>Sokynu<\/a>,2,62),1,60)


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
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 $+ !
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2014
Posts: 8
R
RyuFive Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Nov 2014
Posts: 8
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)
      }

Joined: Nov 2014
Posts: 8
R
RyuFive Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Nov 2014
Posts: 8
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


Link Copied to Clipboard