mIRC Home    About    Download    Register    News    Help

Print Thread
#169435 23/01/07 02:06 AM
Joined: Jan 2004
Posts: 16
S
Pikka bird
OP Offline
Pikka bird
S
Joined: Jan 2004
Posts: 16
I'd like to have a script that checks to see if someone that sends me a private message is on a list of prepared nicks I have, this is what I have so far.

In Remotes:

on 1:NOTICE:*:?:/awaycheck

In Aliases:

awaycheck {
//echo $read(whtlist.txt, s, $nick) | if ( $readn > 0 ) { /echo user is on list }
}

that's assuming that "whtlist.txt" is in the root Mirc directory.

for some reason I cannot get an echo message

Joined: Apr 2006
Posts: 400
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
The only possible way I can think of (this doesn't mean there isn't any other way) is to have this in your whtlist.txt.
Quote:

Nick1 .
Nick2 .
Nick3 .
Nick4 .

It doesn't matter what the symbol after the "Nick1-4" is, as long as there is something after it. The reasoning is because when you use $read(file.txt, s, name-to-search) it will reply with the remaining text after, as said in the help file.

Quote:

//echo $read(info.txt, s, mirc)

Scans the file info.txt for a line beginning with the word mirc and returns the text following the match value.


This is the only way I see it being possible, of course once someone else posts some other way of doing it, i'll feel stupid, lol.

Code:
on *:NOTICE:*:?: {
  if ($read(whtlist.txt, s, $nick)) {
    echo -a User is on list.
  }
  else {
    echo -a User is not on list.
  }
}

I hope this has solved your problem.


-Kurdish_Assass1n
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Just change s to w. You can do an exact match wildcard search using w and no *'s. It's better than s for what he wants anyhow because he might have Nicky in there and someone called Nick would match because of how s works.

$read(whtlist.txt, w, $nick)


Invision Support
#Invision on irc.irchighway.net
Joined: Apr 2006
Posts: 400
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
Originally Posted By: Kurdish_Assass1n

This is the only way I see it being possible, of course once someone else posts some other way of doing it, i'll feel stupid, lol.


Like I said, someone will come along with something better, lol, I guess you could just use this:

Code:
on *:NOTICE:*:?: {
  if ($read(whtlist.txt, w, $nick)) {
    echo -a User is on list.
  }
  else {
    echo -a User is not on list.
  }
}


-Kurdish_Assass1n
Joined: Jul 2006
Posts: 107
L
Vogon poet
Offline
Vogon poet
L
Joined: Jul 2006
Posts: 107
As Kurdish_Assass1n intimated, you have several options. Which one is most efficient depends largely on the number of nicks you are keeping track of.

If you have your heart set on using $read, go with the previous replies. I myself never use $read, for no particular reason, so no doubt this has influenced my suggestions. None of the following suggestions involve mIRC actually reading whtlist.txt.

I'm assuming here that you merely want to know if a person messaging you is using a nick that is in your whtlist.txt

If you white list is very short, and you expect it to remain so, you might simply put the nicks in a variable and use token commands. This approach can be very limiting, tho.

For a not-huge white list, you might consider just adding those nicks to the User file with a level higher than 1 [e.g. 5], and use:


Code:
on 5:NOTICE:*:?: { echo -a $nick is on list }

OR

Code:
on *:NOTICE:*:?: {
  if ($ulevel == 5) echo -a $nick is on list
  else echo -a $nick is NOT on list
}

Be aware that this will trigger every time a level 5 (white list) user says anything in a message window. If you only want this echo when a private conversation begins, use on *:OPEN:?:*: { etc }

If your white list is quite large, you should look into hash tables.



LonDart
Joined: Jan 2004
Posts: 16
S
Pikka bird
OP Offline
Pikka bird
S
Joined: Jan 2004
Posts: 16
Excellent, they worked fine. Is there anyway I can get it to work with queries also?

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Duplicate the code you already used, but change NOTICE to TEXT.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard