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.

SITE.LIST.V1.4 ERROR

Support & discussion of released scripts, and announcements of new releases.
Post Reply
b
bigmike
Voice
Posts: 8
Joined: Mon Oct 24, 2005 9:22 pm

SITE.LIST.V1.4 ERROR

Post by bigmike »

I get the this error after loadin PERPLEX.SITE.LIST.V1.4.EGGDROP.TCL-PERPLEX

Code: Select all

[10:12] Tcl error in file 'modeggdrop.conf':
[10:12] can't set "trigger(help)": variable isn't array
    while executing
"array set trigger {
"help""site.help"
"site-list""site.list"
"site-info""site.info"
"site-add""site.add"
"site-del"..."
    (in namespace eval "::variable" script line 46)
    invoked from within
"namespace eval variable {

# string variable channels
variable channel "#test"

# integer variable style
# 0 = private
# 1 = chan..."
    (file "scripts/sitelist/sitelist
[10:12] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
Here is the code:

Code: Select all

	
	# **********************************************************************
	# * name.....: sitelist
	# * version..: 1.4
	# * date.....: 14:49 2007/04/03
	# * author...: ztx/PPX
	# *
	

   # **********************************************************************
   # * sitelist namespace
   # *
   
   namespace eval ::sitelist {
      
       
	

		
		# **********************************************************************
		# * sitelist settings
		# *
		
		namespace eval variable {
			
			# string variable channels
			variable channel "#test"
			
			# integer variable style
			# 0 = private
			# 1 = channel
			variable style 1
			
			# string variable sqlite
			variable sqlite "/home/bigmike/test/scripts/sitelist/tclsqlite-3.3.13.so"
			
			# string variable database
			variable database "/home/bigmike/test/eggdrop/scripts/sitelist/sitelist.db"
			
			# array variable information
			# 0 = disabled
			# 1 = enabled and only listed in fullinfo
			# 2 = enabled and listed in fullinfo and sitelist
			array set information {
				"link"				1
				"diskspace"			2
				"gadmin"			1
				"siteops"			1
				"location"			2
				"bncs"				1
				"ranking"			1
				"affils"			1
			}
			
			# array variable output
			array set output {
				"list-site"			"#%NR% \002%SITETOKEN%\002"
				"list-info"			" \002x\002 \037%INFONAME%\037: %INFOVALUE%"
				"detail-site"		"\002%SITENAME%\002 \[%SITETOKEN%\]"
				"detail-info"		"\037%INFONAME%\037: %INFOVALUE%"
				"bnc-online"		"%BNC% (\0033up\003)"
				"bnc-offline"		"%BNC% (\0034dn\003)"
				"search"			"#%NR% \002%SITETOKEN%\002 \002x\002 \037%INFONAME%\037: %INFOVALUE%"
				"check-one"			"\002%SITETOKEN%\002 \002x\002 \037bncs\037: %BNCS%"
				"check-all"			"#%NR% \002%SITETOKEN%\002 \002x\002 \037bncs\037: %BNCS%"
			}
			
			# array variable trigger
			array set trigger {
				"help"				"site.help"
				"site-list"			"site.list"
				"site-info"			"site.info"
				"site-add"			"site.add"
				"site-del"			"site.delete"
				"site-change"		"site.change"
				"site-search"		"site.search"
				"site-checkbncs"	"site.checkbncs"
			}
			
			# string variable version
			variable version "1.4"
			
			# string variable author
			variable author "ztx/PPX"
			
		}
		
		
		# **********************************************************************
		# * sitelist binds
		# *
		
		bind pub - $::sitelist::variable::trigger(help) ::sitelist::pub::help
		bind pub - $::sitelist::variable::trigger(site-list) ::sitelist::pub::sitelist
		bind pub - $::sitelist::variable::trigger(site-info) ::sitelist::pub::siteinfo
		bind pub - $::sitelist::variable::trigger(site-add) ::sitelist::pub::siteadd
		bind pub - $::sitelist::variable::trigger(site-del) ::sitelist::pub::sitedel
		bind pub - $::sitelist::variable::trigger(site-change) ::sitelist::pub::sitechange
		bind pub - $::sitelist::variable::trigger(site-search) ::sitelist::pub::sitesearch
		bind pub - $::sitelist::variable::trigger(site-checkbncs) ::sitelist::pub::sitecheckbncs
		
		
		# **********************************************************************
		# * database
		# *
		
		load $::sitelist::variable::sqlite
		
		sqlite3 database $::sitelist::variable::database
		
		database eval "CREATE TABLE IF NOT EXISTS sl_sites(site_token TEXT PRIMARY KEY, site_name TEXT)"
		database eval "CREATE TABLE IF NOT EXISTS sl_information(info_site_token TEXT, info_name TEXT, info_value TEXT)"
		
		
		# **********************************************************************
		# * sitelist pub namespace
		# *
		
		namespace eval pub {
			
			# void proc help
			proc help { nick host handle channel arg } {
				if { ![string equal -nocase $::sitelist::variable::channel $channel] } {
					return 0
				}
				
				foreach { field status } [array get ::sitelist::variable::information] {
					if { $status > 0 } {
						lappend fields $field
					}
				}
				
				::sitelist::misc::privmsg $channel "\037sitelist command overview:\037"
				::sitelist::misc::privmsg $channel "\002$::sitelist::variable::trigger(site-list)\002 <password> - Lists all sites."
				::sitelist::misc::privmsg $channel "\002$::sitelist::variable::trigger(site-info)\002 <password> <sitetoken> - Shows detailed site information."
				::sitelist::misc::privmsg $channel "\002$::sitelist::variable::trigger(site-add)\002 <password> <sitetoken> <sitename> - Adds a site to the database."
				::sitelist::misc::privmsg $channel "\002$::sitelist::variable::trigger(site-del)\002 <password> <sitetoken> - Deletes a site from the database."
				::sitelist::misc::privmsg $channel "\002$::sitelist::variable::trigger(site-change)\002 <password> <sitetoken> <field> \[value\] \[value\] ... - Adds, deletes or changes a site information."
				::sitelist::misc::privmsg $channel "\002$::sitelist::variable::trigger(site-search)\002 <password> <field> <pattern> \[pattern\] ... - Searchs for sites with a specified information."
				if { $::sitelist::variable::information(bncs) } {
					::sitelist::misc::privmsg $channel "\002$::sitelist::variable::trigger(site-checkbncs)\002 <password> \[sitetoken\] - Checks bnc status."
				}
				::sitelist::misc::privmsg $channel "Allowed fields are: [join $fields ", "]"
			}
			
			# void proc sitelist
			proc sitelist { nick host handle channel arg } {
				if { ![string equal -nocase $::sitelist::variable::channel $channel] } {
					return 0
				}
				
				if { [llength [split $arg " "]] != 1 } {
					::sitelist::misc::privmsg $channel "\002Syntax:\002 $::sitelist::variable::trigger(site-list) <password>"
					return 0
				}
				
				set param_password [lindex [split $arg " "] 0]
				set param_nr 0
				
				switch -- $::sitelist::variable::style {
					0 { set target $nick }
					default { set target $channel }
				}
				
				database eval "SELECT * FROM sl_sites" site {
					set msg [string map [list "%NR%" "[incr param_nr]" "%SITETOKEN%" "[decrypt $param_password $site(site_token)]" "%SITENAME%" "[decrypt $param_password $site(site_name)]"] $::sitelist::variable::output(list-site)]
					
					foreach { field status } [array get ::sitelist::variable::information] {
						if { $status != 2 || ![database exists "SELECT info_value FROM sl_information WHERE info_site_token = '$site(site_token)' AND info_name = '[encrypt $param_password $field]'"] } {
							continue
						}
						
						database eval "SELECT info_name, info_value FROM sl_information WHERE info_site_token = '$site(site_token)' AND info_name = '[encrypt $param_password $field]'" information {
							if { [string match -nocase "bncs" [decrypt $param_password $information(info_name)]] } {
								set infovalue [::sitelist::misc::checkbncs [decrypt $param_password $information(info_value)]]
							} else {
								set infovalue [decrypt $param_password $information(info_value)]
							}
							
							append msg [string map [list "%INFONAME%" "$field" "%INFOVALUE%" "$infovalue"] $::sitelist::variable::output(list-info)]
						}
					}
					
					::sitelist::misc::privmsg $target $msg
				}
				
				::sitelist::misc::privmsg $target "End of SITELIST."
			}
			
			# void proc siteinfo
			proc siteinfo { nick host handle channel arg } {
				if { ![string equal -nocase $::sitelist::variable::channel $channel] } {
					return 0
				}
				
				if { [llength [split $arg " "]] != 2 } {
					::sitelist::misc::privmsg $channel "\002Syntax:\002 $::sitelist::variable::trigger(site-info) <password> <sitetoken>"
					return 0
				}
				
				set param_password [lindex [split $arg " "] 0]
				set param_sitetoken [lindex [split $arg " "] 1]
				
				if { ![database exists "SELECT site_token FROM sl_sites WHERE site_token = '[encrypt $param_password $param_sitetoken]'"] } {
					::sitelist::misc::privmsg $channel "\002ERROR:\002 The site you specified doesn't exist."
					return 0
				}
				
				switch -- $::sitelist::variable::style {
					0 { set target $nick }
					default { set target $channel }
				}
				
				database eval "SELECT * FROM sl_sites WHERE site_token = '[encrypt $param_password $param_sitetoken]'" site {
					::sitelist::misc::privmsg $target [string map [list "%SITETOKEN%" "[decrypt $param_password $site(site_token)]" "%SITENAME%" "[decrypt $param_password $site(site_name)]"] $::sitelist::variable::output(detail-site)]
					
					database eval "SELECT info_name, info_value FROM sl_information WHERE info_site_token = '[encrypt $param_password $param_sitetoken]'" information {
						if { [string match -nocase "bncs" [decrypt $param_password $information(info_name)]] } {
							set infovalue [::sitelist::misc::checkbncs [decrypt $param_password $information(info_value)]]
						} else {
							set infovalue [decrypt $param_password $information(info_value)]
						}
						
						::sitelist::misc::privmsg $target [string map [list "%INFONAME%" "[decrypt $param_password $information(info_name)]" "%INFOVALUE%" "$infovalue"] $::sitelist::variable::output(detail-info)]
					}
				}
				
				::sitelist::misc::privmsg $target "End of SITEINFO."
			}
			
			# void proc siteadd
			proc siteadd { nick host handle channel arg } {
				if { ![string equal -nocase $::sitelist::variable::channel $channel] } {
					return 0
				}
				
				if { [llength [split $arg " "]] != 3 } {
					::sitelist::misc::privmsg $channel "\002Syntax:\002 $::sitelist::variable::trigger(site-add) <password> <sitetoken> <sitename>"
					return 0
				}
				
				set param_password [lindex [split $arg " "] 0]
				set param_sitetoken [lindex [split $arg " "] 1]
				set param_sitename [lindex [split $arg " "] 2]
				
				if { [database exists "SELECT site_token FROM sl_sites WHERE site_token = '[encrypt $param_password $param_sitetoken]'"] } {
					::sitelist::misc::privmsg $channel "\002ERROR:\002 The site you specified already exists."
					return 0
				}
				
				database eval "INSERT INTO sl_sites VALUES('[encrypt $param_password $param_sitetoken]', '[encrypt $param_password $param_sitename]')"
				
				::sitelist::misc::privmsg $channel "Site successfully added."
			}
			
			# void proc sitedel
			proc sitedel { nick host handle channel arg } {
				if { ![string equal -nocase $::sitelist::variable::channel $channel] } {
					return 0
				}
				
				if { [llength [split $arg " "]] != 2 } {
					::sitelist::misc::privmsg $channel "\002Syntax:\002 $::sitelist::variable::trigger(site-del) <password> <sitetoken>"
					return 0
				}
				
				set param_password [lindex [split $arg " "] 0]
				set param_sitetoken [lindex [split $arg " "] 1]
				
				if { ![database exists "SELECT site_token FROM sl_sites WHERE site_token = '[encrypt $param_password $param_sitetoken]'"] } {
					::sitelist::misc::privmsg $channel "\002ERROR:\002 The site you specified doesn't exist."
					return 0
				}
				
				database eval "DELETE FROM sl_sites WHERE site_token = '[encrypt $param_password $param_sitetoken]'"
				database eval "DELETE FROM sl_information WHERE info_site_token = '[encrypt $param_password $param_sitetoken]'"
				
				::sitelist::misc::privmsg $channel "Site and all related information successfully deleted."
			}
			
			# void proc sitechange
			proc sitechange { nick host handle channel arg } {
				if { ![string equal -nocase $::sitelist::variable::channel $channel] } {
					return 0
				}
				
				foreach {field state} [array get ::sitelist::variable::information] {
					if { $state > 0 } {
						lappend fields $field
					}
				}
				
				if { [llength [split $arg " "]] < 3 || [lsearch $fields [lindex [split $arg " "] 2]] == -1 } {
					::sitelist::misc::privmsg $channel "\002Syntax:\002 $::sitelist::variable::trigger(site-change) <password> <sitetoken> <field> \[value\] \[value\] ..."
					::sitelist::misc::privmsg $channel "Allowed fields are: [join $fields ", "]"
					return 0
				}
				
				set param_password [lindex [split $arg " "] 0]
				set param_sitetoken [lindex [split $arg " "] 1]
				set param_field [lindex [split $arg " "] 2]
				set param_value [lrange [split $arg " "] 3 end]
				
				if { ![database exists "SELECT site_token FROM sl_sites WHERE site_token = '[encrypt $param_password $param_sitetoken]'"] } {
					::sitelist::misc::privmsg $channel "\002ERROR:\002 The site you specified doesn't exist."
					return 0
				}
				
				if { $param_value == "" } {
					database eval "DELETE FROM sl_information WHERE info_site_token = '[encrypt $param_password $param_sitetoken]' AND info_name = '[encrypt $param_password $param_field]'"
				} elseif { [database exists "SELECT info_site_token FROM sl_information WHERE info_site_token = '[encrypt $param_password $param_sitetoken]' AND info_name = '[encrypt $param_password $param_field]'"] } {
					database eval "UPDATE sl_information SET info_value = '[encrypt $param_password $param_value]' WHERE info_site_token = '[encrypt $param_password $param_sitetoken]' AND info_name = '[encrypt $param_password $param_field]'"
				} else {
					database eval "INSERT INTO sl_information VALUES('[encrypt $param_password $param_sitetoken]', '[encrypt $param_password $param_field]', '[encrypt $param_password $param_value]')"
				}
				
				::sitelist::misc::privmsg $channel "Siteinformation successfully changed."
			}
			
			# void proc sitesearch
			proc sitesearch { nick host handle channel arg } {
				if { ![string equal -nocase $::sitelist::variable::channel $channel] } {
					return 0
				}
				
				foreach {field state} [array get ::sitelist::variable::information] {
					if { $state > 0 } {
						lappend fields $field
					}
				}
				
				set param_password [lindex [split $arg " "] 0]
				set param_field [lindex [split $arg " "] 1]
				set param_pattern [lrange [split $arg " "] 2 end]
				set param_nr 0
				
				if { [llength [split $arg " "]] < 3 || [lsearch $fields $param_field] == -1 } {
					::sitelist::misc::privmsg $channel "\002Syntax:\002 $::sitelist::variable::trigger(site-search) <password> <field> <pattern> \[pattern\] ..."
					::sitelist::misc::privmsg $channel "Allowed fields are: [join $fields ", "]"
					return 0
				}
				
				switch -- $::sitelist::variable::style {
					0 { set target $nick }
					default { set target $channel }
				}
				
				database eval "SELECT info_site_token, info_name, info_value FROM sl_information WHERE info_name = '[encrypt $param_password $param_field]'" information {
					if { [string match -nocase "*[string map [list " " ?] $param_pattern]*" [decrypt $param_password $information(info_value)]] } {
						database eval "SELECT site_token, site_name FROM sl_sites WHERE site_token = '$information(info_site_token)'" site {
							::sitelist::misc::privmsg $target [string map [list "%NR%" "[incr param_nr]" "%SITETOKEN%" "[decrypt $param_password $site(site_token)]" "%SITENAME%" "[decrypt $param_password $site(site_name)]" "%INFONAME%" "[decrypt $param_password $information(info_name)]" "%INFOVALUE%" "[decrypt $param_password $information(info_value)]"] $::sitelist::variable::output(search)]
						}
					}
				}
				
				::sitelist::misc::privmsg $target "End of SITESEARCH."
			}
			
			# void proc sitecheckbncs
			proc sitecheckbncs { nick host handle channel arg } {
				if { ![string equal -nocase $::sitelist::variable::channel $channel] || !$::sitelist::variable::information(bncs) } {
					return 0
				}
				
				if { [llength [split $arg " "]] != 1 && [llength [split $arg " "]] != 2 } {
					::sitelist::misc::privmsg $channel "\002Syntax:\002 $::sitelist::variable::trigger(site-checkbncs) <password> \[sitetoken\]"
					return 0
				}
				
				set param_password [lindex [split $arg " "] 0]
				set param_sitetoken [lindex [split $arg " "] 1]
				set param_nr 0
				
				switch -- $::sitelist::variable::style {
					0 { set target $nick }
					default { set target $channel }
				}
				
				if { $param_sitetoken != "" } {
					if { ![database exists "SELECT site_token FROM sl_sites WHERE site_token = '[encrypt $param_password $param_sitetoken]'"] } {
						::sitelist::misc::privmsg $channel "\002ERROR:\002 The site you specified doesn't exist."
						return 0
					}
					
					if { ![database exists "SELECT info_site_token FROM sl_information WHERE info_site_token = '[encrypt $param_password $param_sitetoken]' AND info_name = '[encrypt $param_password "bncs"]'"] } {
						::sitelist::misc::privmsg $channel "\002ERROR:\002 The site you specified hasn't got a 'bncs' information."
						return 0
					}
					
					database eval "SELECT site_token, site_name FROM sl_sites WHERE site_token = '[encrypt $param_password $param_sitetoken]'" site {
						database eval "SELECT info_value FROM sl_information WHERE info_site_token = '[encrypt $param_password $param_sitetoken]' AND info_name = '[encrypt $param_password bncs]'" information {
							::sitelist::misc::privmsg $target [string map [list "%SITETOKEN%" "[decrypt $param_password $site(site_token)]" "%SITENAME%" "[decrypt $param_password $site(site_name)]" "%BNCS%" "[::sitelist::misc::checkbncs [decrypt $param_password $information(info_value)]]"] $::sitelist::variable::output(check-one)]
						}
					}
				} else {
					database eval "SELECT site_token, site_name FROM sl_sites" site {
						database eval "SELECT info_value FROM sl_information WHERE info_site_token = '$site(site_token)' AND info_name = '[encrypt $param_password "bncs"]'" information {
							::sitelist::misc::privmsg $target [string map [list "%NR%" "[incr param_nr]" "%SITETOKEN%" "[decrypt $param_password $site(site_token)]" "%SITENAME%" "[decrypt $param_password $site(site_name)]" "%BNCS%" "[::sitelist::misc::checkbncs [decrypt $param_password $information(info_value)]]"] $::sitelist::variable::output(check-all)]
						}
					}
					
					::sitelist::misc::privmsg $target "End of CHECKBNCS."
				}
			}
			
		}
		
		
		# **********************************************************************
		# * sitelist misc namespace
		# *
		
		namespace eval misc {
			
			# integer proc bnctest
			proc bnctest { host port } {
				if { [catch { set chan [socket -async $host $port] } error] } {
					return 0
				}
				
				fconfigure $chan -blocking 0 -buffering none
				
				set start [clock seconds]
				
				while { [expr {$start + 5}] > [clock seconds] } {
					if { [read $chan 1] != "" } {
						return 1
					}
				}
				
				return 0
			}
			
			# string proc checkbncs
			proc checkbncs { bncs } {
				foreach bnc [split $bncs " "] {
					if { [llength [split $bnc :]] == 1 } {
						set host $bnc
						set port 21
					} else {
						set host [lindex [split $bnc :] 0]
						set port [lindex [split $bnc :] 1]
					}
					
					if { [::sitelist::misc::bnctest $host $port] } {
						lappend checked [string map [list "%BNC%" "$bnc"] $::sitelist::variable::output(bnc-online)]
					} else {
						lappend checked [string map [list "%BNC%" "$bnc"] $::sitelist::variable::output(bnc-offline)]
					}
				}
				
				return [join $checked ", "]
			}
			
			# void proc privmsg
			proc privmsg { target message } {
				puthelp "PRIVMSG $target :$message"
			}
			
		}
		
		
		# **********************************************************************
		# * author check
		# *
		
		if { ![string equal "d09dd6c5ebe3dcb3bbcf90bf95a0376e" [md5 $::sitelist::variable::author]] } {
			die "Tztztz ... it's not your work!"
		}
		
		
		# **********************************************************************
		# * log
		# *
		
		putlog "sitelist v$::sitelist::variable::version by $::sitelist::variable::author successfully loaded."
		
	}
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

User avatar
MenzAgitat
Op
Posts: 118
Joined: Tue Jul 04, 2006 12:35 pm
Location: France
Contact:

Post by MenzAgitat »

In the settings section of this script, we can find a strange one :

Code: Select all

# string variable author 
variable author "ztx/PPX" 
Is the author's name a setting ?

Answer (spoiler) :

Code: Select all

      # ********************************************************************** 
      # * author check 
      # * 
       
      if { ![string equal "d09dd6c5ebe3dcb3bbcf90bf95a0376e" [md5 $::sitelist::variable::author]] } { 
         die "Tztztz ... it's not your work!" 
      }
I guess that means no :lol:
 
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

LOL I didn't even notice that in the script.
Post Reply