mIRC Home    About    Download    Register    News    Help

Topic Options
#252950 - 18/05/15 02:52 PM find words inside a word
Ravelux Offline
Pikka bird

Registered: 13/03/15
Posts: 19
I have a exported list of subscribers in just one line. Now I wanted to check via mIRC script if provided nickname ($2) exists in this file.

So it would output 'Ravelux was not found' if in subscribers.txt Ravelux is provided as "Ravelux" and not as Ravelux.

subscribers.txt:
Code:
"Ravelux"


command:
Code:
on *:TEXT:!test *:#: {
  if ($read(subscribers.txt,w,$2)) {
    msg $chan Successfully $2 found
  }
  else {
    msg $chan $2 was not found
  }
}

Top
#252951 - 18/05/15 02:55 PM Re: find words inside a word [Re: Ravelux]
splinny Offline
Fjord artisan

Registered: 14/05/15
Posts: 249
test.txt: "splinny" "splin" (1st line)
$false = //echo -ag $istok($read(test.txt,1),splin,32)
$true = //echo -ag $istok($read(test.txt,1),"splinny",32)
_________________________
Dont give a fish - teach to fish!

Top
#252952 - 18/05/15 02:59 PM Re: find words inside a word [Re: splinny]
Ravelux Offline
Pikka bird

Registered: 13/03/15
Posts: 19
Thank you for your answer. Could you explain me those lines to understand them?

I don't know how I can use this in my problem.

Top
#252954 - 18/05/15 03:19 PM Re: find words inside a word [Re: Ravelux]
splinny Offline
Fjord artisan

Registered: 14/05/15
Posts: 249
$istok checks if there is exatly same token as it is written, an "32" - separator ($chr(32) = "space"). Yo can read mIRC help file about tokens for more info, there is a lot commands for tokens.
_________________________
Dont give a fish - teach to fish!

Top
#252955 - 18/05/15 03:38 PM Re: find words inside a word [Re: splinny]
Ravelux Offline
Pikka bird

Registered: 13/03/15
Posts: 19
Okay, thank you.
But I don't know if this way would help me out in this way.
Because this textfiles includes 1 line and 49432 characters with no space between.

Top
#252956 - 18/05/15 03:46 PM Re: find words inside a word [Re: Ravelux]
splinny Offline
Fjord artisan

Registered: 14/05/15
Posts: 249
Looks like you have a lot of subs shocked
_________________________
Dont give a fish - teach to fish!

Top
#252957 - 18/05/15 04:02 PM Re: find words inside a word [Re: splinny]
Ravelux Offline
Pikka bird

Registered: 13/03/15
Posts: 19
No, I am not the streamer. I am just configuring the bot for the streamer. And subscribers should add them multiple times into the list.

So the bot needs to check:
Is it a sub? Yes? Add him multiple times.

Top
#252960 - 18/05/15 04:45 PM Re: find words inside a word [Re: Ravelux]
Loki12583 Offline
Hoopy frood

Registered: 22/01/04
Posts: 1244
A simple text file is not how you should be checking subscribers; use a hash table. If this list is composed by mIRC itself use a hash table to begin with. If this list is composed by another source parse it into a hash table first for future use.

Is this a JSON file? JSON parsers already exist that you can use to get these nicks into a hash table.

/help hash tables


Edited by Loki12583 (18/05/15 04:51 PM)

Top
#252965 - 18/05/15 05:25 PM Re: find words inside a word [Re: Loki12583]
Ravelux Offline
Pikka bird

Registered: 13/03/15
Posts: 19
Okay, maybe my way is wrong.

I have a link where I get this one line in webbrowser. I just did get this content via vbs into a textfile and now I want to check this file if $2 is provided in this file.

Maybe you have a better way because I just dont know?

So maybe there is a way to get the information if $2 is a sub or not without saving it into a file?


Edited by Ravelux (18/05/15 08:24 PM)

Top