|
Joined: Nov 2006
Posts: 3
Self-satisified door
|
OP
Self-satisified door
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.
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
if you play the out text to the channel wont that work?
|
|
|
|
Joined: Nov 2006
Posts: 3
Self-satisified door
|
OP
Self-satisified door
Joined: Nov 2006
Posts: 3 |
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.
|
|
|
|
Joined: Dec 2004
Posts: 66
Babel fish
|
Babel fish
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.
|
|
|
|
Joined: Nov 2006
Posts: 3
Self-satisified door
|
OP
Self-satisified door
Joined: Nov 2006
Posts: 3 |
Sweet worked like a charm!! and i'll change the dir :-)
thanks alot
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
not sure what didnt work for you my sample
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
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
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
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
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.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
|