This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
-
uffs
- Voice
- Posts: 14
- Joined: Thu Apr 17, 2008 9:18 pm
- Location: 6°10.5S-106°49.7E
Post
by uffs »
hi..
I found small script to check tcl script before we running "rehash" command.. (to known the scripts error or no)
here's the code
Code: Select all
bind dcc n chk script:load
proc script:load { handle idx text } {
if { [catch { uplevel #0 [list source scripts/$text.tcl] } error] } {
putlog "Error While Loading $text -- Errormsg: $error"
putlog "script: $text -- ::errorInfo: $::errorInfo"
return
}
putlog "script: <$text> -- Loaded Without Error.."
return
}
how I make those code so it will be running on public command and display the result on the room chan.
Thanks for your help
-
tomekk
- Master
- Posts: 255
- Joined: Fri Nov 28, 2008 11:35 am
- Location: Oswiecim / Poland
-
Contact:
Post
by tomekk »
try:
Code: Select all
bind pub -|- chk script_check
proc script_check { nick uhost hand chan arg } {
set the_name [lindex [split $arg] 0]
if {[catch {uplevel #0 [list source scripts/$the_name.tcl]} error]} {
putquick "PRIVMSG $chan :Error While Loading $the_name -- Errormsg: $error"
putquick "PRIVMSG $chan :script: $the_name -- ::errorInfo: $::errorInfo"
return
}
putquick "PRIVMSG $chan :script: <$the_name> -- Loaded Without Error.."
}
putlog "chk-script.tcl loaded"
12:43:11 <@tomekk> chk chk-script
12:43:13 < botty> script: <chk-script> -- Loaded Without Error..
12:43:36 <@tomekk> chk chk-script
12:43:36 < botty> Error While Loading chk-script -- Errormsg: invalid command name "}"
12:43:36 < botty> script: chk-script -- ::errorInfo: invalid command name "}"