mIRC Home    About    Download    Register    News    Help

Print Thread
#26670 28/05/03 05:01 PM
Joined: May 2003
Posts: 29
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: May 2003
Posts: 29
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

#26671 28/05/03 05:31 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
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
}
}
}
}

Last edited by pheonix; 28/05/03 05:41 PM.

new username: tidy_trax
#26672 28/05/03 05:33 PM
Joined: Mar 2003
Posts: 36
B
Ameglian cow
Offline
Ameglian cow
B
Joined: Mar 2003
Posts: 36
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

#26673 28/05/03 07:13 PM
Joined: May 2003
Posts: 29
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: May 2003
Posts: 29
Your script brought me into a loop shocked

Can anyone do better? grin

#26674 28/05/03 07:29 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
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
}
}


new username: tidy_trax
#26675 28/05/03 07:30 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
that should work a bit better


new username: tidy_trax
#26676 28/05/03 08:35 PM
Joined: May 2003
Posts: 29
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: May 2003
Posts: 29
lol

Another loop shocked

#26677 28/05/03 08:47 PM
Joined: May 2003
Posts: 29
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: May 2003
Posts: 29
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


#26678 28/05/03 08:56 PM
Joined: May 2003
Posts: 730
S
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
on *:text:& ate a *:#:{ if (!$read(ate.txt,w,$1-)) { write ate.txt $1- } }

#26679 28/05/03 09:23 PM
Joined: May 2003
Posts: 29
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: May 2003
Posts: 29
Such an easy line and it works like a charm...

Thnx!!! grin blush

#26680 28/05/03 10:53 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Directewd at Pheonix:
Quote:

Can anyone do better?


Thats the understatement of the centry >:\


-KingTomato

Link Copied to Clipboard