egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

web banlist help [solved]
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
mavericku
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: somewhere in the world

PostPosted: Sun Oct 22, 2006 7:18 am    Post subject: web banlist help [solved] Reply with quote

Error
Code:

[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:

##################################
### 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?
_________________
mavericku


Last edited by mavericku on Mon Oct 23, 2006 5:41 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sun Oct 22, 2006 11:12 am    Post subject: Reply with quote

Probably because you're using [list] 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 [list yourdata] 0 end] {
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Sun Oct 22, 2006 11:37 am    Post subject: Reply with quote

What's the point using lrange on a list?

http://www.tcl.tk/man/tcl8.5/TclCmd/lrange.htm
Quote:
This command will return a new list consisting of elements first through last, inclusive.


I'd try something like:

Code:
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 {} {
Back to top
View user's profile Send private message
mavericku
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: somewhere in the world

PostPosted: Sun Oct 22, 2006 11:38 am    Post subject: Reply with quote

well... that doesn't work either .. (rosc2112)

Code:
[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
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mavericku
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: somewhere in the world

PostPosted: Sun Oct 22, 2006 11:43 am    Post subject: Reply with quote

metroid wrote:
What's the point using lrange on a list?

http://www.tcl.tk/man/tcl8.5/TclCmd/lrange.htm
Quote:
This command will return a new list consisting of elements first through last, inclusive.


I'd try something like:

Code:
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:

[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
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Sun Oct 22, 2006 11:45 am    Post subject: Reply with quote

Code:
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 {}] {
Back to top
View user's profile Send private message
mavericku
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: somewhere in the world

PostPosted: Sun Oct 22, 2006 12:04 pm    Post subject: Reply with quote

metroid wrote:
Code:
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 {}] {


Sad

Code:
[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
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Sun Oct 22, 2006 12:12 pm    Post subject: Reply with quote

oops, i accidently left in a ] there.

Code:
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 {} {
Back to top
View user's profile Send private message
mavericku
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: somewhere in the world

PostPosted: Sun Oct 22, 2006 12:39 pm    Post subject: Reply with quote

metroid wrote:
oops, i accidently left in a ] there.

Code:
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:
[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
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Oct 22, 2006 3:10 pm    Post subject: Reply with quote

Just tested the foreach-loop as written in the first post, and it works like a charm.. (using tclsh)

Code:
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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
mavericku
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: somewhere in the world

PostPosted: Sun Oct 22, 2006 6:03 pm    Post subject: Reply with quote

nml375 wrote:
Just tested the foreach-loop as written in the first post, and it works like a charm.. (using tclsh)

Code:
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
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Oct 22, 2006 6:08 pm    Post subject: Reply with quote

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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
mavericku
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: somewhere in the world

PostPosted: Sun Oct 22, 2006 6:12 pm    Post subject: Reply with quote

a couple of them

here is the list
Code:


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
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sun Oct 22, 2006 6:15 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
mavericku
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: somewhere in the world

PostPosted: Sun Oct 22, 2006 6:18 pm    Post subject: Reply with quote

pfff.. what to do ...? :-<
_________________
mavericku
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber