i am working on a blacklist script and so far it works fine.. I am adding a nick and reason and it saves and deletes fine..
alias -l txt { return C:\Users\hifin\Desktop\mibbitnames\badnick.txt }
alias -l mychan { return #mastercontrol }
ON *:TEXT:!add *:$($mychan): {
write $qt($txt) $2-
msg $chan 4ADD Watched nick - $2-
}
ON *:TEXT:!del *:$($mychan): {
write -d $qt($txt) $2-
msg $chan 3DELETED Watched nick - $2-
}
ON *:TEXT:!viewlist:$($mychan): {
var %t = $lines($txt)
if (!$file($txt)) { msg $chan The file is empty! | return }
msg $chan 6LIST Incoming PM
msg $nick Start of file.. - (Lines: %t $+ )
var %i = 1
while (%i <= %t) {
var %r = $read($txt,n,%i)
if (%r) { msg $nick %r }
inc %i
}
msg $nick End of file. - (Size: $bytes($file($txt).size).suf $+ )
}
From this script.. i am using a matching code to see if a nick is on this file and this works fine
var %NaughtyList = $read(C:\Users\hifin\Desktop\mibbitnames\badnick.txt, sw, $4)
if (%NaughtyList) {
/msg #mastercontrol 9,1Connected Watched Nick - $4
splay -w C:/Users/hifin/Desktop/New_Server_Bot/mIRC/sounds/message.wav
}
now.. this is what i need to get changed which i can't do.. atm.. i am looking on the txt tile for a matching nick which is always specified by $4... but.. I want the script to message the channel the nick - reason FROM the txt file instead.. where atm it just says connected watched nick - $4 (nick)
The txt file contains nick reason on seperate lines like this
gary troublemaker
radomly testuser
julie needs help with channel
can i have an edit please so that the script outputs the information on the matched nick "and" the reason from the txt file please
$read()
with the s
switch returns the text after the matched word, as per the documentation:
//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.
You can use $read()
in conjunction with $readn
, which returns the line number if a match is found, and do something like this:
var %NaughtyList = $read($txt, s, $1)
if ($readn) {
var %buf = $read($txt, $readn)
msg #mastercontrol Connected Watched $gettok(%buf, 1, 32) - $gettok(%buf, 2-, 32)
splay -w C:/Users/hifin/Desktop/New_Server_Bot/mIRC/sounds/message.wav
}
This will grab the nick and the reason and output
Connected Watched julie - needs help with channel
when searching for julie
.