mIRC Home    About    Download    Register    News    Help

Print Thread
#252950 18/05/15 01:52 PM
Joined: Mar 2015
Posts: 19
R
Ravelux Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Mar 2015
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
  }
}

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
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!
Joined: Mar 2015
Posts: 19
R
Ravelux Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Mar 2015
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.

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
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!
Joined: Mar 2015
Posts: 19
R
Ravelux Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Mar 2015
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.

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Looks like you have a lot of subs shocked


Dont give a fish - teach to fish!
Joined: Mar 2015
Posts: 19
R
Ravelux Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Mar 2015
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.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
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

Last edited by Loki12583; 18/05/15 03:51 PM.
Joined: Mar 2015
Posts: 19
R
Ravelux Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Mar 2015
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?

Last edited by Ravelux; 18/05/15 07:24 PM.

Link Copied to Clipboard