Elo all!
I need a script who will respond to the @find command. if someone'll type "@find blah" on a channel it should search "blah" in a textfile and paste the whole line
Here is a script like what i need but the maxsearch should be changed, it should ignore the user for 35 seconds when using the trigger and should ONLY reply with 1 match (this one replyes all matches to the user):
####################################################################################################
putlog "TextSearcher v0.2 - 1st Offcial Release by IsP (q_lander@hotmail.com)"
#
# This script simply searches a txt file (or text files) for search criteria specified via pub
# or msg commands. It Lets you search within a text file for key words using case insensitive
# trigger commands.
#
# Test on eggdrop v1.6.X.....use at own risk
#
# This script was originally made from another script for 1Real by y0manda,
# rewritten from ground up by IsP@Underent.org
#
# TODO:
# - You tell me?
#
# v0.1 - 1st scripted
# v0.2 - Fixed the counter to display the correct count!
# - Minor bug fix with proc $args - opps, was a mistake, honest ;P
#
####################################################################################################
#Where are the data files? (Use "{file location1} {file location2} {file location 3} {etc...}")
set cd_release "{./text/list1.txt} {./text/list2.txt}"
#Which channels do I check for the command?
set rlschans "#channel1 #channel2 #channel3"
#Max number of ourputs?
set rlsmaxsearch 9
#What's the public trigger?
set cmdsearch "!search"
#What Users are allowed to use this trigger/command? (Leave blank for anyone)
set rlsflag ""
#Set your inital tag info here
set rlsinfo "Brought to you by IsP@Undernet:"
########## DO NOT EDIT BELOW ##########
if {$rlsflag == ""} {set rlsflag "-"}
bind pub $rlsflag $cmdsearch rlssearchpub
proc rlssearchpub {nick uhost handle chan arg} {
global rlschans
set valch 0
foreach ch [split $rlschans] {if {$chan == $ch} {set valch 1}}
if {$valch == 0} {return}
rlslocate $nick $uhost $handle "NOTICE" "$arg"
}
bind msg $rlsflag $cmdsearch rlssearchmsg
proc rlssearchmsg {nick uhost handle arg} {
global rlschans
set valch 0
foreach ch [split $rlschans] {if {[botonchan $ch]} {if {[onchan $nick $ch]} {set valch 1}}}
if {$valch == 0} {return}
rlslocate $nick $uhost $handle "PRIVMSG" "$arg"
}
proc rlslocate {nick uhost handle type arg} {
global rlsmaxsearch cd_release rlsinfo
if {$arg == ""} {puthelp "$type $nick :Syntax: $cmdsearch <search string>" ;return 0}
regsub -all -- " " ${arg} "*" rlsarg
puthelp "$type $nick : $rlsinfo ...Searching for '$rlsarg'"
set totrlsfound 0
foreach database $cd_release {
set rlsfile [open $database r]
while {![eof $rlsfile]} {
set rlsline [gets $rlsfile]
if {[string match "*$rlsarg*" [string tolower $rlsline]]} {
incr totrlsfound 1
if {$totrlsfound < $rlsmaxsearch} {
puthelp "$type $nick : \002Found:\002 $rlsline"
}
}
}
close $rlsfile
}
if {$totrlsfound > $rlsmaxsearch} {puthelp "$type $nick :There are over $rlsmaxsearch matches. Please be more specific"}
puthelp "$type $nick :There was a total of $totrlsfound entries matching your query."
}
______________
Thanks in advance!