mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2006
Posts: 6
T
Tenza Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Aug 2006
Posts: 6
Hello there /wave

I'm new to this board, which seems filled with knowledgable fine gentlemen.

I'm using mIRC 6.19, trying to make a *LARGE* textfile containing quotes and other good lines.
Each quote is on a line by itself, and I've seen that you can then use /filter to "search" by matchtext and output the line it finds to a window/alias/file

however, when I try to do this, I fail smirk

/filter -fw H:\mIRC\quotes.txt #humor-n-fun *chaplin*
gives me: * /filter: invalid window

if I do
/filter -ff H:\mIRC\quotes.txt H:\mIRC\testfilter.txt *chaplin*
I get a new textfile with all the chaplin lines in it

#humor-n-fun is a normal channel

what am I doing wrong ?

it's supposed to end up being a "search engine" sorts of, using on *:TEXT:blah blah blah

remote script so ppl can type for instance:

!funsearch *chaplin*

and have all the lines returned in a priv msg window..

can anyone help ? I feel really silly asking for help, since it looks "simple" in the help files, it just doesn't work

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
you can use the filter output in the textfile to play it to the requesting nick
.play $nick filename

this will save you from flooding if there are a large number of matched lines

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Quote:
I'm using mIRC 6.19


mIRC goes from 6.17 to 6.2

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
This isn't actually an error. /filter can't filter to channel windows. Just outputs to @win/file/dialog_id

If you absolutely must /filter to a channel window, use an alias as the output.

alias chanecho { echo #SOMECHANNEL $1 }

/filter -wk #channel1 chanecho *stuff*

Alternatively, you can /filter to a file, and then /loadbuf the file into the channel. :P

As hixxy pointed out, mIRC 6.19 was never released, so you have either 6.20, 6.17, 6.16, or something below those.

Edit: Also, if you plan on messaging the text, you might as well /filter it to a file, and then /play it, as MikeChat has mentioned.

Last edited by Rand; 29/08/06 05:34 AM.
Joined: Aug 2006
Posts: 6
T
Tenza Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Aug 2006
Posts: 6
wow, thank you

I'm dying to try out the different suggestions, will do that later today, when I have more time..

and you're right, it's not 6.19, it's 6.16 smirk

my bad

is it possible to combine this with a "remote" ?

and then respond to the person ?

on 1:TEXT:!jokeme*:#fun-n-games,?:/filter -cff h:\mIRC\quotes.txt h:\mIRC\temp\$nick.txt *$1*
/play $nick h:\mIRC\temp\$nick.txt 500

?

would this in effect be able to let ppl in #fun-n-games write
!jokeme *sheep*

and recieve filtered content from the txt file, in a /msg to them ?

it seems right to me, but how do I hook the remote and the /play command together ?

like this ?

on 1:TEXT:!jokeme*:#fun-n-games,?:{
/filter -cff h:\mIRC\quotes.txt h:\mIRC\temp\$nick.txt *$1*
/play $nick h:\mIRC\temp\$nick.txt 500 }

?

/sorry for being such a newb

Last edited by Tenza; 29/08/06 10:42 AM.
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
In your example, all you'd really need to do to make it work is: \ $+ $nick $+ .txt

Edit: Just so you know, you shouldn't have stuff touching identifiers, unless it's inside of another identifier (ie: $calc($1 + $2) ) So if you're doing *$1* you'd really want: * $+ $1 $+ *

Or: $+(*,$1,*)

Either of those methods will evaluate $1, and then attach the *'s to it.

I'm not sure how your file is layed out, but the way you are performing the /filter, you would be searching for !jokeme since that is what $1 would be. If you want to filter based on the users text, you'd want to use $2-.

Unless of course the lines in the file you have start with !jokeme or something.

Last edited by Rand; 29/08/06 12:20 PM.
Joined: Aug 2006
Posts: 6
T
Tenza Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Aug 2006
Posts: 6
hmm ..

I tried a few different approaches, got some progress and now it works...

I split it up into the on 1:TEXT remote and an alias in remote also.

here follows:

on 1:TEXT:!jokeme*:#fun-n-games,?:/jokealias $nick $2
alias jokealias {
/filter -cff h:\mIRC\quotes.txt h:\mIRC\temp\ $+ $1 $+ .txt * $+ $2 $+ *
/play $1 h:\mIRC\temp\ $+ $1 $+ .txt 500
}

only thing left, is to figure out if it can send an "error msg" if no jokes are found using /filter

awesome guys, you rawk tbh

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
on 1:TEXT:!jokeme*:#fun-n-games,?:/jokealias $nick $2
alias jokealias { 
  filter -cff h:\mIRC\quotes.txt filteredjokestempfile.txt $+(*,$2,*)
  if (!$filtered) { write -c filteredjokestempfile.txt No Jokes matched your request of $2 }
  play $1 filteredjokestempfile.txt 500
  .remove filteredjokestempfile.txt
} 

* code untested *

(1) You dont need to filter to a user specificly named file becuase when you play it it can be imediatly erased, as the play command buffers the file contents.
(2) $filtered returns the number of lines matched so i use it to check for zero, and if so write an error into the file

Joined: Aug 2006
Posts: 6
T
Tenza Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Aug 2006
Posts: 6
aah, didn't know about $filtered

nice one

will check it later, perhaps adapt it a bit, but it looks right to me

about the .remove tempfile thingy, is not really nescessary
/filter -cff
the -c will clear the previous file before stuffing text in there

I'll post the final result, when I have checked it

ty /<3

Joined: Aug 2006
Posts: 6
T
Tenza Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Aug 2006
Posts: 6
the code you posted works flawlessly:D

I did remove the .remove sentence, as it has no meaning when filter uses -c

awesome

ty again

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I know what -c does, but I removed the file so its not sitting there afterwards, its called housekeeping, clean up what mess ya make. It was also to demonstrate that the file does not need to exist for the lngth of the play commands actions, thus a signle filename can be used, they dont need to be nick specific filenames.

Joined: Aug 2006
Posts: 6
T
Tenza Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Aug 2006
Posts: 6
aye, true dat

however, keeping the last file gives me the possibility to add something like "last result" option, possibly make a history function, so users can list their last 10 searches...

however, I'm not gonna go there for quite a while laugh

I'm very happy with the script as it is....

thanx again for the awesome help


Link Copied to Clipboard