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!
mavericku
Halfop
Posts: 62 Joined: Sun Jun 12, 2005 11:32 pm
Location: somewhere in the world
Contact:
Post
by mavericku » Sun Oct 22, 2006 7:18 am
Error
Code: Select all
[01:43] WEBBANLIST: The template file could not be opened; using default.
[01:43] Tcl error in file 'eggdrop.conf':
[01:43] couldn't set loop variable: "s"
while executing
"foreach {s v} [list Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000
#FFFFFF Page_TCC_2 #E0E0E0 P..."
(file "scripts/WebBanList1.1.tcl" line 54)
invoked from within
"source scripts/WebBanList1.1.tcl"
(file "eggdrop.conf" line 1346)
TCL
Code: Select all
##################################
### WebBanList.tcl ###
### Version 1.1 ###
### By Wcc ###
### wcc@techmonkeys.org ###
### http://www.dawgtcl.com:81/ ###
### EFnet #|DAWG|Tcl ###
##################################
############################################################################
### Copyright © 2000 - 2002 |DAWG| Scripting Group. All rights reserved. ###
############################################################################
##############################################################################
## This script generates a web page listing all global and channel bans in ##
## the bot's banlist. ##
##############################################################################
##########################################################
## Just load the script, edit the settings, and rehash. ##
##########################################################
######################################################################
# Set here the path to the DAWG template file you would like to use. #
# You can obtain templates by visiting http://dawg.oc255.net:81/ and #
# clicking the templates link. #
######################################################################
set webbanlist_setting(tpl) "./scripts/WebBanList_DAWG.tpl"
##########################################
# Set the filename of the web page here. #
##########################################
set webbanlist_setting(page) "../web/banlist.html"
####################
# Code begins here #
####################
if {![string match 1.6.* $version]} { putlog "\002WEBBANLIST:\002 \002WARNING:\002 This script is intended to run on eggdrop 1.6.x or later." }
if {[info tclversion] < 8.2} { putlog "\002WEBBANLIST:\002 \002WARNING:\002 This script is intended to run on Tcl Version 8.2 or later." }
bind time - "*0 * * * *" webbanlist_createhtml
bind time - "*5 * * * *" webbanlist_createhtml
set webbanlist_setting(version) "1.1"
set webbanlist_notpl 0
if {![info exists webbanlist_setting(tpl)] || [catch {source $webbanlist_setting(tpl)}]} {
putlog "\002WEBBANLIST:\002 The template file could not be opened; using default."
set webbanlist_notpl 1
}
foreach {s v} [list Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000 Page_BGC \
#FFFFFF Page_TCC_2 #E0E0E0 Page_TCC_1 #C0C0C0 Page_THC_2 #8080E0 Page_THC_1 #8080C0 Page_TCS 4 Page_THS 5 Page_TitleS 6 \
Page_Title {Ban List} Page_TitleTag {Ban List} Page_Img {}] {
if {$webbanlist_notpl || ![info exists webbanlist_setting($s)]} { set webbanlist_setting($s) $v }
}
proc webbanlist_format_td {type line center text} {
switch -- $type {
"title" { return "<font size=\"$::webbanlist_setting(Page_THS)\" color=\"$::webbanlist_setting(Page_TextC)\">[expr ($center)?{<center>}:{}]$text[expr ($center)?{</center>}:{}]</font>" }
"header" { return "<td align=\"left\" bgcolor=\"$::webbanlist_setting(Page_THC_${line})\"><font size=\"$::webbanlist_setting(Page_THS)\" color=\"$::webbanlist_setting(Page_HC)\">[expr ($center)?{<center>}:{}]$text[expr ($center)?{</center>}:{}]</font></td>" }
"cell" { return "<td align=\"left\" bgcolor=\"$::webbanlist_setting(Page_TCC_${line})\"><font size=\"$::webbanlist_setting(Page_TCS)\" color=\"$::webbanlist_setting(Page_CC)\">[expr ($center)?{<center>}:{}]$text[expr ($center)?{</center>}:{}]</font></td>" }
}
}
proc webbanlist_timedate {unixtime} {
if {$unixtime == 0} { return "Never" }
return [clock format $unixtime -format {%I:%M %p %D}]
}
proc webbanlist_createhtml {args} {
set dt [clock format [clock seconds] -format {%I:%M %p %D}]
set page [open $::webbanlist_setting(page) w]
puts $page "<html>\n <head>\n <title>$::webbanlist_setting(Page_TitleTag)</title>\n <META NAME=\"description\" CONTENT=\"Ban List\">\n <META NAME=\"keywords\" CONTENT=\"bans, irc, eggdrop, tcl, link\">\n </head>\n\n <body bgcolor=\"$::webbanlist_setting(Page_BGC)\" link=\"$::webbanlist_setting(Page_LinkC)\" alink=\"$::webbanlist_setting(Page_LinkC)\" vlink=\"$::webbanlist_setting(Page_LinkC)\">"
if {[string compare $::webbanlist_setting(Page_Img) ""] != 0} { puts $page " <center><img src=\"$::webbanlist_setting(Page_Img)\"></img></center>" }
puts $page " <center><font size=\"$::webbanlist_setting(Page_TitleS)\" color=\"$::webbanlist_setting(Page_TTextC)\">$::webbanlist_setting(Page_Title)</font></center>\n <br>"
puts $page " <br>\n <br>\n [webbanlist_format_td title 0 1 {Global Bans}]\n <br>\n <table align=\"center\">\n <tr>"
foreach {a b} [list 1 Number 2 Ban 1 Comment 2 Expires 1 Added 2 {Last Used} 1 Creator] { puts $page " [webbanlist_format_td header $a 1 $b]" }
puts $page " </tr>"
if {[string compare [banlist] ""] == 0} {
puts $page " <tr>"
foreach {a b} [list 1 - 2 - 1 - 2 - 1 - 2 - 1 -] { puts $page " [webbanlist_format_td cell $a 1 $b]" }
puts $page " </tr>"
} {
set bnum 0
foreach b [banlist] {
incr bnum
puts $page " <tr>"
foreach {a b} [list 1 $bnum 2 [lindex $b 0] 1 [lindex $b 1] 2 [webbanlist_timedate [lindex $b 2]] 1 [webbanlist_timedate [lindex $b 3]] 2 [webbanlist_timedate [lindex $b 4]] 1 [lindex $b 5]] { puts $page " [webbanlist_format_td cell $a 1 $b]" }
puts $page " </tr>"
}
}
puts $page " </table>\n <br>\n <br>"
foreach chan [channels] {
if {[string compare [banlist $chan] ""] == 0} { continue }
set servernum 0
puts $page " [webbanlist_format_td title 0 1 "$chan Bans"]\n <br>\n <table align=\"center\">\n <tr>"
foreach {a b} [list 1 Number 2 Ban 1 Comment 2 Expires 1 Added 2 {Last Used} 1 Creator] { puts $page " [webbanlist_format_td header $a 1 $b]" }
puts $page " </tr>"
set bnum 0
foreach b [banlist $chan] {
incr bnum
puts $page " <tr>"
foreach {a b} [list 1 $bnum 2 [lindex $b 0] 1 [lindex $b 1] 2 [webbanlist_timedate [lindex $b 2]] 1 [webbanlist_timedate [lindex $b 3]] 2 [webbanlist_timedate [lindex $b 4]] 1 [lindex $b 5]] { puts $page " [webbanlist_format_td cell $a 1 $b]" }
puts $page " </tr>"
}
puts $page " </table>\n <br>\n <br>"
}
puts $page " <center><font color=\"$::webbanlist_setting(Page_TextC)\">Last Updated: $dt</font></center>\n <center><font color=\"$::webbanlist_setting(Page_TextC)\">Generated By: $::botnick</font></center>\n </body>\n</html>\n<!--<DAWGID>WebBanList $::webbanlist_setting(version)</DAWGID>-->"
close $page
}
putlog "\002WEBBANLIST:\002 WebBanList Version $webbanlist_setting(version) by Wcc is loaded."
Can anyone help me with this and tell me what it is wrong with it?
Last edited by
mavericku on Mon Oct 23, 2006 5:41 am, edited 2 times in total.
mavericku
rosc2112
Revered One
Posts: 1454 Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania
Post
by rosc2112 » Sun Oct 22, 2006 11:12 am
Probably because you're using
but not also using [lrange] or something to break up the list for the 'foreach' command.. Foreach is seeing it as ONE long var (the entire list), rather than as pairs of data. Might try like
foreach {s v} [lrange
metroid
Owner
Posts: 771 Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid » Sun Oct 22, 2006 11:37 am
What's the point using lrange on a list?
http://www.tcl.tk/man/tcl8.5/TclCmd/lrange.htm
This command will return a new list consisting of elements first through last, inclusive.
I'd try something like:
Code: Select all
foreach {s v} [list Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000 Page_BGC \
#FFFFFF Page_TCC_2 #E0E0E0 Page_TCC_1 #C0C0C0 Page_THC_2 #8080E0 Page_THC_1 #8080C0 Page_TCS 4 Page_THS 5 Page_TitleS 6] \
Page_Title {Ban List} Page_TitleTag {Ban List} Page_Img {} {
mavericku
Halfop
Posts: 62 Joined: Sun Jun 12, 2005 11:32 pm
Location: somewhere in the world
Contact:
Post
by mavericku » Sun Oct 22, 2006 11:38 am
well... that doesn't work either .. (rosc2112)
Code: Select all
[18:33] Tcl error in file 'eggdrop.conf':
[18:33] couldn't set loop variable: "s"
while executing
"foreach {s v} [lrange [list Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000 Page_BGC \
#FFFFFF Page_TCC_2 #..."
(file "scripts/WebBanList1.1.tcl" line 54)
invoked from within
"source scripts/WebBanList1.1.tcl"
(file "eggdrop.conf" line 1346)
mavericku
mavericku
Halfop
Posts: 62 Joined: Sun Jun 12, 2005 11:32 pm
Location: somewhere in the world
Contact:
Post
by mavericku » Sun Oct 22, 2006 11:43 am
metroid wrote: What's the point using lrange on a list?
http://www.tcl.tk/man/tcl8.5/TclCmd/lrange.htm
This command will return a new list consisting of elements first through last, inclusive.
I'd try something like:
Code: Select all
foreach {s v} [list Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000 Page_BGC \
#FFFFFF Page_TCC_2 #E0E0E0 Page_TCC_1 #C0C0C0 Page_THC_2 #8080E0 Page_THC_1 #8080C0 Page_TCS 4 Page_THS 5 Page_TitleS 6] \
Page_Title {Ban List} Page_TitleTag {Ban List} Page_Img {} {
after following your advice .. i've got this
Code: Select all
[18:39] Tcl error in file 'eggdrop.conf':
[18:39] invalid command name "Page_Title"
while executing
"Page_Title {Ban List} Page_TitleTag {Ban List} Page_Img {}"
invoked from within
"foreach {s v} [list Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000 Page_BGC \
#FFFFFF Page_..."
(file "scripts/WebBanList1.1.tcl" line 54)
invoked from within
"source scripts/WebBanList1.1.tcl"
mavericku
metroid
Owner
Posts: 771 Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid » Sun Oct 22, 2006 11:45 am
Code: Select all
foreach {s v} {Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000 Page_BGC #FFFFFF Page_TCC_2 #E0E0E0 Page_TCC_1 #C0C0C0 Page_THC_2 #8080E0 Page_THC_1 #8080C0 Page_TCS 4 Page_THS 5 Page_TitleS 6} Page_Title {Ban List} Page_TitleTag {Ban List} Page_Img {}] {
mavericku
Halfop
Posts: 62 Joined: Sun Jun 12, 2005 11:32 pm
Location: somewhere in the world
Contact:
Post
by mavericku » Sun Oct 22, 2006 12:04 pm
metroid wrote: Code: Select all
foreach {s v} {Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000 Page_BGC #FFFFFF Page_TCC_2 #E0E0E0 Page_TCC_1 #C0C0C0 Page_THC_2 #8080E0 Page_THC_1 #8080C0 Page_TCS 4 Page_THS 5 Page_TitleS 6} Page_Title {Ban List} Page_TitleTag {Ban List} Page_Img {}] {
Code: Select all
[19:00] extra characters after close-brace
while executing
"foreach {s v} {Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000 Page_BGC #FFFFFF Page_TCC_2 #E0E0E0 Page_TCC_..."
(file "scripts/WebBanList1.1.tcl" line 54)
invoked from within
"source scripts/WebBanList1.1.tcl"
(file "eggdrop.conf" line 1347)
mavericku
metroid
Owner
Posts: 771 Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid » Sun Oct 22, 2006 12:12 pm
oops, i accidently left in a ] there.
Code: Select all
foreach {s v} {Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000 Page_BGC #FFFFFF Page_TCC_2 #E0E0E0 Page_TCC_1 #C0C0C0 Page_THC_2 #8080E0 Page_THC_1 #8080C0 Page_TCS 4 Page_THS 5 Page_TitleS 6} Page_Title {Ban List} Page_TitleTag {Ban List} Page_Img {} {
mavericku
Halfop
Posts: 62 Joined: Sun Jun 12, 2005 11:32 pm
Location: somewhere in the world
Contact:
Post
by mavericku » Sun Oct 22, 2006 12:39 pm
metroid wrote: oops, i accidently left in a ] there.
Code: Select all
foreach {s v} {Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000 Page_BGC #FFFFFF Page_TCC_2 #E0E0E0 Page_TCC_1 #C0C0C0 Page_THC_2 #8080E0 Page_THC_1 #8080C0 Page_TCS 4 Page_THS 5 Page_TitleS 6} Page_Title {Ban List} Page_TitleTag {Ban List} Page_Img {} {
Gosh .. this s**ks
Code: Select all
[19:33] couldn't set loop variable: "s"
while executing
"foreach {s v} {Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000 Page_BGC #FFFFFF Page_TCC_2 #E0E0E0 Page_TCC_..."
(file "scripts/WebBanList1.1.tcl" line 54)
invoked from within
"source scripts/WebBanList1.1.tcl"
(file "eggdrop.conf" line 1347)
mavericku
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Sun Oct 22, 2006 3:10 pm
Just tested the foreach-loop as written in the first post, and it works like a charm.. (using tclsh)
Code: Select all
set webbanlist_notpl 1
1
% foreach {s v} [list Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000 Page_BGC \
#FFFFFF Page_TCC_2 #E0E0E0 Page_TCC_1 #C0C0C0 Page_THC_2 #8080E0 Page_THC_1 #8080C0 Page_TCS 4 Page_THS 5 Page_TitleS 6 \
Page_Title {Ban List} Page_TitleTag {Ban List} Page_Img {}] {
if {$webbanlist_notpl || ![info exists webbanlist_setting($s)]} { set webbanlist_setting($s) $v }
}
% array names webbanlist_setting
Page_TTextC Page_BGC Page_Img Page_THC_1 Page_THC_2 Page_Title Page_TCC_1 Page_HC Page_TCC_2 Page_TitleS Page_TitleTag Page_CC Page_THS Page_TextC Page_LinkC Page_TCS
Also produces the same results on a 1.6.17 eggie (built with tcl8.4)
NML_375
mavericku
Halfop
Posts: 62 Joined: Sun Jun 12, 2005 11:32 pm
Location: somewhere in the world
Contact:
Post
by mavericku » Sun Oct 22, 2006 6:03 pm
nml375 wrote: Just tested the foreach-loop as written in the first post, and it works like a charm.. (using tclsh)
Code: Select all
set webbanlist_notpl 1
1
% foreach {s v} [list Page_CC #000000 Page_HC #000000 Page_LinkC #0000FF Page_TTextC #000000 Page_TextC #000000 Page_BGC \
#FFFFFF Page_TCC_2 #E0E0E0 Page_TCC_1 #C0C0C0 Page_THC_2 #8080E0 Page_THC_1 #8080C0 Page_TCS 4 Page_THS 5 Page_TitleS 6 \
Page_Title {Ban List} Page_TitleTag {Ban List} Page_Img {}] {
if {$webbanlist_notpl || ![info exists webbanlist_setting($s)]} { set webbanlist_setting($s) $v }
}
% array names webbanlist_setting
Page_TTextC Page_BGC Page_Img Page_THC_1 Page_THC_2 Page_Title Page_TCC_1 Page_HC Page_TCC_2 Page_TitleS Page_TitleTag Page_CC Page_THS Page_TextC Page_LinkC Page_TCS
Also produces the same results on a 1.6.17 eggie (built with tcl8.4)
you mean that the tcl works .... ? well it gave me those errors..
and i have
[12:03:20] *** ¢ VERSION reply of 'eggdrop v1.6.17+SSL' from Shivers
[12:03:20] *** ¢ VERSION reply of 'eggdrop v1.6.17+SSL' from r0b0t on which i have tested it.
mavericku
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Sun Oct 22, 2006 6:08 pm
Well, atleast that part works without any problems on my system..
The error text you get makes me think there's something preventing "s" from being assigned a value (like a write-protected variable). Nothing I've seen in that script would impose those restrictions on that variable however.
Do you run any other scripts/modules on that bot?
NML_375
mavericku
Halfop
Posts: 62 Joined: Sun Jun 12, 2005 11:32 pm
Location: somewhere in the world
Contact:
Post
by mavericku » Sun Oct 22, 2006 6:12 pm
a couple of them
here is the list
Code: Select all
source scripts/alltools.tcl
source scripts/action.fix.tcl
source scripts/xw.tcl
source scripts/op.tcl
source scripts/OPTools.tcl
source scripts/bseen1.4.2.tcl
source scripts/xlogin.tcl
source scripts/wow.tcl
source scripts/idle.tcl
source scripts/chanpro2.2.tcl
source scripts/noticepro.tcl
#source scripts/rotrivia.tcl
#source scripts/WebBanList1.1.tcl
#source scripts/ingadvert.tcl
source scripts/respond.tcl
mavericku
rosc2112
Revered One
Posts: 1454 Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania
Post
by rosc2112 » Sun Oct 22, 2006 6:15 pm
Loaded fine for me as well, using eggdrop 1.6.18 and tcl v8.4.11 on a linux/i686 system.
[18:03] WEBBANLIST: The template file could not be opened; using default.
[18:03] WEBBANLIST: WebBanList Version 1.1 by Wcc is loaded.
Fixed the template name:
[18:10] WEBBANLIST: WebBanList Version 1.1 by Wcc is loaded.
mavericku
Halfop
Posts: 62 Joined: Sun Jun 12, 2005 11:32 pm
Location: somewhere in the world
Contact:
Post
by mavericku » Sun Oct 22, 2006 6:18 pm
pfff.. what to do ...? :-<
mavericku