Actually, I think what he meant is the reason you require the state is because without it you are presented with a list of possible matches rather than a definite match.
CtrlAltDel wrote:
[23:18:01] <Kein> $weather boston
[23:22:34] <Bot> [22:22] Tcl error [pub_wz]: can't read "outtitle": no such variable
Looks like I was wrong all my life.
Can you just make it... optional? Let it return the first result, c'mon. It will not break anything or destroy the eternity.
He would rather it just take the top suggested result and roll with that than give a tcl error mentioning some non-existant variable, "outtitle". Or, at the very least, present the potential list of matches and ask for refinement. I don't think guy was asking for the moon, or your first born child. That makes damn good sense. You should embrace the ideas coming from people using your script, rather than impose your disdain upon them. And yeah, lighten up. It's only irc, type /clear. Breathe. ;D
Edit:
Code: Select all
find this:
regexp {<title>(.*?)</title>} $html match outtitle
if {[string first Search $outtitle] !=-1} {puthelp "NOTICE $nick :Check your syntax, use .wz -help";close $wzsock;return 0}
if {[string first Error $outtitle] !=-1} {puthelp "NOTICE $nick :Location not found, please check spelling.";close $wzsock;return 0}
change it to this:
if {![regexp {<title>(.*?)</title>} $html match outtitle]} {
puthelp "NOTICE $nick :You need to supply more information for that location.."
close $wzsock;return 0
}
if {[string first Search $outtitle] !=-1} {puthelp "NOTICE $nick :Check your syntax, use .wz -help";close $wzsock;return 0}
if {[string first Error $outtitle] !=-1} {puthelp "NOTICE $nick :Location not found, please check spelling.";close $wzsock;return 0}
That will at least give a proper error message to the user, rather than cause a tcl error.