@find test test1
in stead of @find test*test1
and also make it work if it's the other way arround
cause now it only finds the words if it's in the txt like this "test ... test1"
and if i would use @find test1 test it wouldn't give any results
oh also and how could i return an other msg if there is no search results
ive tryed
Code: Select all
if {$cnt == 0} {
...
} else {
...
}
return 0
}

Code: Select all
bind PUB - @find find:pub
proc find:pub {nick uhost hand chan arg} {
set srch [lindex $arg 0]
set wfile [open "cnt.txt" "w"]
puts -nonewline $wfile 0
close $wfile
putserv "PRIVMSG $nick :Searching for $srch"
set fs [open "search.txt" r]
while {![eof $fs]} {
gets $fs line
set sline [string tolower $line]
if {[string match *$srch* $sline] == 1} {
set rfile [open "cnt.txt" "r"]
set rcnt [read $rfile]
close $rfile
set count [expr $rcnt + 1]
set wfile [open "cnt.txt" "w"]
puts -nonewline $wfile $count
close $wfile
putserv "PRIVMSG $nick :$line"
}
}
set rfile [open "cnt.txt" "r"]
set cnt [read $rfile]
close $rfile
putserv "PRIVMSG $nick :Search complete found $cnt results"
return 0
}