mIRC Home    About    Download    Register    News    Help

Print Thread
#163804 04/11/06 11:12 PM
Joined: Nov 2006
Posts: 3
N
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Nov 2006
Posts: 3
hi , my first post so go easy on me. I wrote a quote script and there stored in info1.txt, Now i wanted to expand it so users can search it like !qsearch *text*, i tried using $read(info.txt, w, $1-) but that did not work for me. So for testing purposes i tried replacing the $1 with sample text, that worked but only pulled the first match, basically i want to do this but pull random matches meeting that search criteria and spit them into the channel.

i also just tried /test /filter -ff c:\info1.txt c:\out.txt $1- < this will work for me and i could just do a $read for out.txt , but its not accepting the $1-

thanks in advance

Last edited by notrock4; 05/11/06 12:02 AM.
#163805 04/11/06 11:56 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
if you play the out text to the channel wont that work?

#163806 05/11/06 12:01 AM
Joined: Nov 2006
Posts: 3
N
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Nov 2006
Posts: 3
Quote:
if you play the out text to the channel wont that work?


no when i type /test <text> it doesn't create the out.txt
but if i make the alias /test /filter -ff c:\info1.txt c:\out.txt <text> it works fine

Last edited by notrock4; 05/11/06 12:03 AM.
#163807 05/11/06 12:04 AM
Joined: Dec 2004
Posts: 66
B
Babel fish
Offline
Babel fish
B
Joined: Dec 2004
Posts: 66
If you want to randomly use one of the matching quotes it seems the combination of filter and read is way to go. A couple of changes to the filter command:

filter -ffc c:\info1.txt c:\out.txt * $+ $1- $+ *

or:

filter -ffc c:\info1.txt c:\out.txt $+(*,$1- ,*)

The -c switch clears the output window/file before writing to it.

The “*”s make the search wild, the way you had it the match would have to be exact from beginning to end, except for case.

Also as a matter of general practice I wouldn’t use the root C:\ folder that way, I’d make a subfolder of your mirc folder.

#163808 05/11/06 12:11 AM
Joined: Nov 2006
Posts: 3
N
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Nov 2006
Posts: 3
Sweet worked like a charm!! and i'll change the dir :-)


thanks alot

#163809 05/11/06 12:18 AM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
not sure what didnt work for you

my sample
Code:
on *:text:!qsearch *:#:{
  filter -ffc info.txt out.txt * $+ $2*
  play $chan out.txt
}


make sure the text names are correct

if you expect to have alot of lines, add a playback speed to slow that down

if you have a lot of jokers flooding you wiht requests, search these forums for anti flooding, in fact the past week has some methods

#163810 05/11/06 02:36 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Just as a note on your original $read...

$read(info.txt, w, $1-)

Unless *'s are in $1-, you will have problems unless $1- is the entire line of text from the text file. Instead, you should have * $+ $1- $+ * in there, or else $+(*,$1-,*). Wildcard matches need wildcards, or it expects an exact match of the entire line.


Invision Support
#Invision on irc.irchighway.net
#163811 05/11/06 02:57 AM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
$1 is !qsearch which i don't believe will match anything in the info.txt so even the inclusion of the wild card wont find a match

#163812 05/11/06 04:32 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Good point. If I had actually written the code out, I'd have noticed that. I was just pointing out how to use a wildcard search. smile


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard