mIRC Homepage
Posted By: Chandler Filtering in a txt-file - 28/05/03 05:01 PM
Somebody knows how to solve this:

Code:
on *:TEXT:*ate*banana*fish*:#1,#2,#3: /write ate.txt $chan $nick ate $3 $4 


The words don't mather... But since i look in three sites with some nicks who are the same, i want to look in the ate.txt is ther was allready before a exact same line... ie. Chandler ate a banana -> txt : #1 Chandler ate a banana; in chan 2 i do the same so txt say: #2 Chandler ate a banana...

What i want is that the script looks into the txt file and if that line ($nick ate a $4) is allready there, he doesn't have to write it...

U understand what i want to say? smile grin
Posted By: pheonix Re: Filtering in a txt-file - 28/05/03 05:31 PM
on *:TEXT:*:$comchan($me,1-) {
if (*banana* iswm $1-) {
var %i 1
while(%i <= $read(ate.txt).lines) {
if ($replace($1-,*banana*,banana,) !iswm $read(ate.txt,%i)) {
/write ate.txt $nick ate $replace($1-,*banana*,banana)
}
inc %i
}
elseif (*fish* iswm $1-) {
var %i 1
while(%i <= $read(ate.txt).lines) {
if ($replace($1-,*fish*,fish) !iswm $read(ate.txt,%i)) {
/write ate.txt $nick ate $replace($1-,*fish*,fish)
}
inc %i
}
}
}
}
Posted By: bugx Re: Filtering in a txt-file - 28/05/03 05:33 PM
You can use the command $read to search if
your words exists

//echo $read(file.txt, w, *your words here*)

if not exists returns $null, the you can write your line
Posted By: Chandler Re: Filtering in a txt-file - 28/05/03 07:13 PM
Your script brought me into a loop shocked

Can anyone do better? grin
Posted By: pheonix Re: Filtering in a txt-file - 28/05/03 07:29 PM
on *:TEXT:*:$comchan($me,1-) {
var %i 1
while(%i <= $read(ate.txt).lines) {
if (*banana* iswm $1-) || (*fish* iswm $1-) || (*ate* iswm $1-) && ($replace($1-,*banana*,banana,*ate*,ate,*fish*,fish) !iswm $read(ate.txt,%i)) {
/write ate.txt $nick ate $replace($1-,*banana*,banana)
}
inc %i
}
}
Posted By: pheonix Re: Filtering in a txt-file - 28/05/03 07:30 PM
that should work a bit better
Posted By: Chandler Re: Filtering in a txt-file - 28/05/03 08:35 PM
lol

Another loop shocked
Posted By: Chandler Re: Filtering in a txt-file - 28/05/03 08:47 PM
I'll try to explain it a bit better...

text-file:
Code:
Chandler ate a banana
Dude ate a fish
Dude ate a banana
Chandler ate a fish
Murr ate a monkey


Now, when some1 types in the chan i'm in:
Murr ate a monkey, that line should NOT been written to the text-file, but Murr ate a banana, should be written to the file...

Will this help to adjust the script? grin

Posted By: ScatMan Re: Filtering in a txt-file - 28/05/03 08:56 PM
on *:text:& ate a *:#:{ if (!$read(ate.txt,w,$1-)) { write ate.txt $1- } }
Posted By: Chandler Re: Filtering in a txt-file - 28/05/03 09:23 PM
Such an easy line and it works like a charm...

Thnx!!! grin blush
Posted By: KingTomato Re: Filtering in a txt-file - 28/05/03 10:53 PM
Directewd at Pheonix:
Quote:

Can anyone do better?


Thats the understatement of the centry >:\
© mIRC Discussion Forums