Some notes
Code: Select all
source /home/Kicky/calbot/scripts/vars.tcl
this line is found in the code, this is basically stupid as this path will never be right for 99.9999% of all users
Code: Select all
if {[string match -nocase $arguments ""]} {
i would personally just use
Code: Select all
if {[lindex [split $arguments] 0] == ""} {
seeing as your code would get an error because you don't split $arguments
Code: Select all
if {[string match -nocase $arguments ""]} {
putquick "NOTICE $nickname :Quotes.tcl is currently [quotes::check $channel]"
}
if {[string match -nocase $arguments "on"]} {
channel set $channel +quote
putquick "NOTICE $nickname :Done. Quotes are now enabled."
return
}
if {[string match -nocase $arguments "off"]} {
channel set $channel -quote
putquick "NOTICE $nickname :Done. Quotes are now disabled."
}
It's imo better to use
Code: Select all
if {[string equal -nocase [lindex [split $arguments] 0] on]} {
channel set $channel +quote
putquick "NOTICE $nickname :Done. Quotes are now enabled."
} elseif {[string equal -nocase [lindex [split $arguments] 0] off]} {
channel set $channel -quote
putquick "NOTICE $nickname :Done. Quotes are now enabled."
} else {
putquick "NOTICE $nickname :Quotes is currently [expr {[channel get $channel quote] ? "on" : "off"}]"
}
Viewing your code i see alot of if's where you can easily use elseif's.
All those if's are not needed and elseif would be a better a choice.
It's upto you to use what i'm saying, i'm not forcing upon it nor am i saying your a bad scripter. I used to write my scripts the same way
Take my advice/suggestions or don't. That's completely upto you
