Code: Select all
tag when posting logs, code
Code: Select all
...
set text [string map {[ ( ] ) $ " dollar "} $text]
...
catch {set ergebnis [expr $text]} fehler
...
rosc2112 wrote:You mean like '1 + 1' ? Not sure I follow your meaning.
Code: Select all
'1 + 1'
Code: Select all
tag when posting logs, code
I don't see that as a problem, it just makes the script return an error msg.Code: Select all
'1 + 1'
It does use split on the user input.you might want to take a look at my FAQ post about splitting
Code: Select all
catch {set http [::http::geturl "${query}daily${input}.html" -timeout [expr 1000 * 15]]} error
[..snip..]
catch {set http [::http::geturl "${query}dailychinese${input}.html" -timeout [expr 1000 * 15]]} error
[..snip..]
if {[string match -nocase "*couldn't open socket*" $error]} {
return "Error: couldn't connect..Try again later"
}
if { [::http::status $http] == "timeout" } {
[..snip..]
Code: Select all
regsub -- "^${incith::horoscope::command_char}" $input "" input
to:
regsub -- ^\\. $input "" input
Code: Select all
Original:
namespace eval horoscope {
# SEND_OUTPUT
# no point having two copies of this in public/private_message{}
#
proc send_output {input where} {
foreach line [incith::horoscope::parse_output [horoscope $input]] {
putquick "PRIVMSG $where :$line"
}
}
---
My change:
namespace eval horoscope {
# SEND_OUTPUT
# no point having two copies of this in public/private_message{}
proc send_output {input where} {
if {$input == ""} {
puthelp "PRIVMSG $where :Please choose a sign: capricorn aquarius pisces aries taurus gemini cancer leo virgo libra scorpio sagittarius rat ox tiger rabbit dragon snake horse goat monkey rooster dog pig"
return
}
set validsign 0
foreach sign [split $incith::horoscope::valid_signs " "] {
if {$input == $sign} {
set validsign 1
}
}
if {$validsign == 0} {
puthelp "PRIVMSG $where :Please choose a sign: capricorn aquarius pisces aries taurus gemini cancer leo virgo libra scorpio sagittarius rat ox tiger rabbit dragon snake horse goat monkey rooster dog pig"
return
} else {
foreach line [incith::horoscope::parse_output [horoscope $input]] {
puthelp "PRIVMSG $where :$line"
}
}
}
Code: Select all
proc send_output {input where} {
set validsign 0
foreach sign [split $incith::horoscope::valid_signs " "] {
if {$input == $sign} {
set validsign 1
}
}
if {($validsign == 0) || ($input == "")} {
puthelp "PRIVMSG $where :Please choose a valid sign: etc etc"
return
} else {
foreach line [incith::horoscope::parse_output [horoscope $input]] {
puthelp "PRIVMSG $where :$line"
}
}
}
Ahh, didn't know you handed it off. I'll have to grab a more recent version (I have v1.8 in my archive)incith wrote: If you do submit any google changes, they'd have to go to the guy I handed the script over to, madwoota.
Yep, just tried it, and it workedAs for horoscope..
The . problem can likely be resolved by changing the regexp to {} instead of ""