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.

Clanbase Script - small problem!

Old posts that have not been replied to for several years.
Locked
R
Rav
Voice
Posts: 13
Joined: Mon Feb 24, 2003 8:47 am

Clanbase Script - small problem!

Post by Rav »

Hi,

Using this script the commands. !update and !clanrank work fine. However the !nextwar brings up this error....

Can anyone help with this, It was working then started with the errors and nothing has been changed ;(

Code: Select all

BUG: ClanBase has changed, make sure your cid and lid settings are correct. If not, e-mail wcc@techmonkeys.org with this data: cbjsWarUpcoming_Start();cbjsWarUpcoming_End();
The script I downloaded is:

Code: Select all

##################################################################
## This script gets clan information from www.ClanBase.com and  ##
## reports it to a channel when you type a trigger. Information ##
## includes next war and clan rank next war.                    ##
##                                                              ##
## NOTE: The bot will pause briefly during an update.           ##
##                                                              ##
## Based on code by ppslim.                                     ##
##################################################################

##############
## COMMANDS ##
############################################
## PUB ## !clanrank (Can be changed)      ##
######### Shows the current rank and      ##
######### points your clan currently has. ##
######### ------------------------------- ##
######### !nextwar (Can be changed)       ##
######### Shows information about the     ##
######### next war.                       ##
######### ------------------------------- ##
######### !update (Can be changed)        ##
######### Manually updates ClanBase info. ##
############################################

##########################################################
## Just load the script, edit the settings, and rehash. ##
##########################################################

################################################
# Set the flag required to view the info here. #
################################################

set clanbase_setting(flag) "-|-"

##################################
# Set the next-war command here. #
##################################

set clanbase_setting(cmd_nxtwar) "!nextwar"

###################################
# Set the clan rank command here. #
###################################

set clanbase_setting(cmd_crank) "!rank"

################################
# Set the update command here. #
################################

set clanbase_setting(cmd_updt) "!update"

##################################
# Set your League ID (LID) here. #
##################################

set clanbase_setting(lid) "219"

################################
# Set your Clan ID (CID) here. #
################################

set clanbase_setting(cid) "160276"

########################################################################
# How often (In minutes) would you like the information to be updated? #
########################################################################

set clanbase_setting(timer_update) "10"

####################
# Code begins here #
####################

if {![string match 1.6.* $version]} {
	putlog "\002CLANBASE:\002 \002CRITICAL ERROR\002 ClanBase.tcl requires eggdrop 1.6.x to run."
	die "\002CLANBASE:\002 \002CRITICAL ERROR\002 ClanBase.tcl requires eggdrop 1.6.x to run."
}
if {[info tclversion] < 8.2} {
	putlog "\002CLANBASE:\002 \002CRITICAL ERROR\002 ClanBase.tcl requires Tcl 8.2 or above to run."
	die "\002CLANBASE:\002 \002CRITICAL ERROR\002 ClanBase.tcl requires Tcl 8.2 or above to run."
}

package require http
bind pub $clanbase_setting(flag) $clanbase_setting(cmd_crank) clanbase_showrank
bind pub $clanbase_setting(flag) $clanbase_setting(cmd_nxtwar) clanbase_shownext
bind pub $clanbase_setting(flag) $clanbase_setting(cmd_updt) clanbase_update

if {![string match *clanbase_time_update* [timers]]} { timer $clanbase_setting(timer_update) clanbase_time_update }

proc clanbase_update {nick uhost hand chan text} {
	clanbase_time_update
	putserv "PRIVMSG $chan :The ClanBase information has been updated."
}
proc clanbase_time_update {} {
	global clanbase_data clanbase_setting
	set q [::http::formatQuery wars 1 cid $clanbase_setting(cid) lid $clanbase_setting(lid)]
	set q2 [::http::formatQuery cid $clanbase_setting(cid)]
	::http::config -useragent "ClanBase.tcl"
	set tok [::http::geturl http://www.clanbase.com/claninfo.php -query $q]
	if {[::http::ncode $tok] != 200} {
		set clanbase_data(rank) 0
	} else {
		if {[regexp {Rank: (.*) \((.*) points\)} [::http::data $tok] match rank points]} {
			set clanbase_data(rank) [list $rank $points [unixtime]]
		} else {
			set clanbase_data(rank) 0
		}
	}
	set tok2 [::http::geturl http://www.clanbase.com/cbjswarupcoming.php -query $q2]
	if {[::http::ncode $tok2] != 200} {
		set clanbase_data(nextwar) 0
	} else {
		regsub -all -- "\"" "[::http::data $tok2]" "" data
		regsub -all -- "," "$data" "" data
		if {[regexp {cbjsWarUpcoming_Start\(\)\;cbjsWarUpcoming_Each\((.*)\)\;cbjsWarUpcoming_End\(\)\;} $data match data]} { set clanbase_data(nextwar) 0 }
		if {[llength $data] < 10} {
			set clanbase_data(nextwar) 0
			putlog "BUG: ClanBase has changed, make sure your cid and lid settings are correct. If not, e-mail wcc@techmonkeys.org with this data: $data"
		} else {
			set wid [lindex $data 0]
			set with [lindex $data 1]
			set time [lindex $data 4]
			set date [lindex $data 5]
			set game [lindex $data 8]/[lindex $data 9]
			set clanbase_data(nextwar) [list $with $time $date $game http://www.clanbase.com/warinfo.php?[::http::formatQuery wid $wid] [unixtime]]
		}
	}
	::http::cleanup $tok
	::http::cleanup $tok2
	if {![string match *clanbase_time_update* [timers]]} { timer $clanbase_setting(timer_update) clanbase_time_update }
}
proc clanbase_showrank {nick uhost hand chan text} {
	global clanbase_data
	if {![info exists clanbase_data(rank)]} {
		puthelp "PRIVMSG $chan :The information has not been downloaded yet. Please wait until the next update."
	} elseif {[string equal $clanbase_data(rank) 0]} {
		puthelp "PRIVMSG $chan :An error occurred the last time the information was downloaded. Try again later."
	} else {
		set ts "[duration [expr [unixtime] - [lindex $clanbase_data(rank) end]]] ago."
		puthelp "PRIVMSG $chan :Rank: [lindex $clanbase_data(rank) 0] Points: [lindex $clanbase_data(rank) 1] Updated: $ts"
	}
}
proc clanbase_shownext {nick uhost hand chan text} {
	global clanbase_data
	if {![info exists clanbase_data(nextwar)]} {
		puthelp "PRIVMSG $chan :The information has not been downloaded yet. Please wait until the next update."
	} elseif {[string equal $clanbase_data(nextwar) 0]} {
		puthelp "PRIVMSG $chan :An error occurred the last time the information was downloaded. Try again later."
	} else {
		set ts "[duration [expr [unixtime] - [lindex $clanbase_data(nextwar) end]]] ago."
		puthelp "PRIVMSG $chan :Next War: [lindex $clanbase_data(nextwar) 0], [lindex $clanbase_data(nextwar) 1] [lindex $clanbase_data(nextwar) 2], [lindex $clanbase_data(nextwar) 3]. Details: [lindex $clanbase_data(nextwar) 4] Updated: $ts"
	}
}
putlog "\002CLANBASE:\002 ClanBase.tcl Version 1.1 by Wcc is loaded."
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

as the error said : mail to wcc, ask in #|DAWG|Tcl @ EFNet or leave a msg @ http://forum.dawgtcl.com/
R
Rav
Voice
Posts: 13
Joined: Mon Feb 24, 2003 8:47 am

Post by Rav »

Brilliant.. what good help! :roll:

Perhaps I should have emailed 3 times and waited for 2 weeks before trying to get help here... no wait.. I did that already... I am not a retard and manners are free young boy.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Without letting know what steps you have taken, we are unable to know that you have, send 3 emails and waited two weeks.

Most of the time, we will state the obvious, because many people do not bother reading.

On top, I didn't know people had to provide free support because you demand it, both within two weeks, and with or without attitude (of which, I did not any in the first reply).
R
Rav
Voice
Posts: 13
Joined: Mon Feb 24, 2003 8:47 am

Post by Rav »

Thanks for the civil and polite reply appreciated.

Normally I would give people the benefit of the doubt that they have done the "blatently obvious things" perhaps you know you target audience better.

At no point did I demand support..
Can anyone help with this
Is a question not a demand.. Do not worry.. have wasted plenty of time writing replys and no further to solving it on this forums... Thanks for your time anyway.
m
madgabz
Voice
Posts: 20
Joined: Thu Apr 04, 2002 8:00 pm
Location: Copenhagen, Denmark
Contact:

k!

Post by madgabz »

OK, bickering aside...

I downloaded the latest script for ClanBase info just to test if i could find any errors. Guess what? It works beautifully w. my windrop 1.6.12!!!

Maybe re-download it, and reinstall, Rav?

If any1 remotely keen on tcl scripting could add a little codesnippet to remove the html bold tags from clanbase's rank-info? :D
R
Rav
Voice
Posts: 13
Joined: Mon Feb 24, 2003 8:47 am

Post by Rav »

Thanks

yeah I downloaded it again.. worked fine then 2 days later things went funny.. odd
m
madgabz
Voice
Posts: 20
Joined: Thu Apr 04, 2002 8:00 pm
Location: Copenhagen, Denmark
Contact:

weird...

Post by madgabz »

Thats really weird, Rav, still chugs along fine here, and i have a PILE of TCL scripts running on the side!
What eggdrop are you using? OS? shell?
R
Rav
Voice
Posts: 13
Joined: Mon Feb 24, 2003 8:47 am

Post by Rav »

Seems to be ok now.. might have been a "blip" somewhere but so far so good.

Its latest eggdrop on hosted shell.
Locked