Code: Select all
if {[botisop $chan]} {
pushmode $chan -o $nick
} else {
puthelp "PRIVMSG $chan :I'm not oped."
}
Code: Select all
if {[botisop $chan]} {
pushmode $chan -o $nick
} elseif {[isop $other $chan]} {
puthelp "PRIVMSG $other :please deop $nick on $chan."
} elseif {[isop $other2 $chan]} {
puthelp "PRIVMSG $other2 :please deop $nick on $chan."
} else {
puthelp "PRIVMSG $chan :neither me, $other or $other2 are oped on $chan."
}
Code: Select all
if {[botisop $chan] || [isop $nick $chan]} {
putlog "Either the bot or $nick is oped on $chan."
}
Code: Select all
if {[botisop $chan] && [isop $nick $chan]} {
putlog "Both the bot and $nick are oped on $chan."
}
Code: Select all
if {<expr1> || <expr2>} {
...
}
Code: Select all
if {<expr1> && <expr2>} {
...
}
Code: Select all
if {[info exists foo] && ($foo == $bar)} {
# do something
}
That means dcc .set command is unbound. To make it work, go to your .conf file and change the line that says:<owner> .set errorInfo
<bot> What? You need '.help'
tounbind dcc n set *dcc:set
And that applies to the tcl command as well (the bind that's before it).#unbind dcc n set *dcc:set
PS: All those variables are documented, read them.set owner "<your handle>"
Code: Select all
# the new file
set ::proc_recover(setting,file) recoverfile.tcl
proc recover { pattern } {
set file [open $::proc_recover(setting,file) a]
foreach proc [lsort [info commands]] {
if { [string match -nocase $pattern $proc] || [string equal -nocase $pattern $proc] } {
puts $file "\n"
puts $file "############################################################################################################################"
puts $file "# $proc"
puts $file "############################################################################################################################"
puts $file "\n"
puts $file "proc $proc \{ [info args $proc] \} \{"
puts $file "[info body $proc]"
puts $file "\}"
}
}
close $file
}
# .tcl recover $pattern
# the pattern must be the exact procname or match it (wildcards possible)
If you restarted the bot after then you have to google for "undelete" (depends on your platform)..tcl foreach var [lsort [info globals]] { putlog $var }
.tcl foreach bind [binds] { putlog $bind }
.tcl foreach bind [binds pub] { putlog $bind }
Code: Select all
set reply [rand 5]
Code: Select all
set reply [rand [llength $replies]]
Code: Select all
set reply [lindex $replies [rand [llength $replies]]]
Code: Select all
#In short here is an example script:
set replies {
{hi!}
{how are you?}
{whats up}
}
bind pubm - "*" auto:reply
proc auto:reply {nick uhost hand chan text} {
global replies
putserv "PRIVMSG $chan :[lindex $replies [rand [llength $replies]]]"
}
Code: Select all
bind evnt - init-server {putserv "privmsg nickserv :id password";#}
Code: Select all
bind msg - hi foo
bind pub - hi foo
proc foo {nick args} {
putserv "privmsg $nick :hello goober"
}
Try this instead:sKy wrote:Code: Select all
puts $file "proc $proc \{ [info args $proc] \} \{" puts $file "[info body $proc]" puts $file "\}"
Code: Select all
proc printproc proc {
set args {}
foreach arg [info args $proc] {
if {[info default $proc $arg val]} {
lappend args [list $arg $val]
} {
lappend args [list $arg]
}
}
list proc $proc $args [info body $proc]
}
Code: Select all
puts $file [printproc $proc]
Code: Select all
proc string2list s {
if [catch {eval list $s} res] {
set res [list]
foreach i [split $s] {
if {$i!=""} {lappend res $i}
}
}
set res
} ;#RS
% string2list {a b c d}
a b c d
% string2list "a b c {"
a b c \{
% string2list {unbalanced "}
unbalanced {"}
Code: Select all
tag when posting logs, code
Try 'string2list {[exit]}' using that proc The catch doesn't make any sense... RS must have created that proc before he learned Tcldemond wrote:Code: Select all
proc string2list s { if [catch {eval list $s} res] { set res [list] foreach i [split $s] { if {$i!=""} {lappend res $i} } } set res } ;#RS % string2list {a b c d} a b c d % string2list "a b c {" a b c \{ % string2list {unbalanced "} unbalanced {"}
Code: Select all
proc string2list s {
set res [list]
foreach i [split $s] {
if {$i!=""} {lappend res $i}
}
set res
}
Code: Select all
proc string2list s {
split [eval concat [split $s]]
}
Code: Select all
proc string2list {s {c "\n\t "}} {
set res [list]
foreach i [split $s $c] {
if {$i!=""} {lappend res $i}
}
set res
}