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.

ppslim, can u make this script now?

Old posts that have not been replied to for several years.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

OK, I took all the code and tested it localy, I found a few problems, that had been left from my basic tests.

I have tested it, but not on eggdrop, so there may still be a few oddities left.

Code: Select all

proc time:getrank {args} {
  global clansys
  if {![llength [info commands "::http::geturl"]]} {
    if {[catch {package require http} ver]} {
      putlog "Loading problem "${ver}""
      return
    } else {
      putlog "Loaded http v${ver}"
    }
  }
  set q [::http::formatQuery wars 1 cid 63888 lid 222]
  ::http::config -useragent "Eggdrop clan ranker"
  set tok [::http::geturl http://www.clanbase.com/claninfo.php -query $q]
  if {[::http::ncode $tok] != 200} {
    set clansys 0
  } else {
    if {[regexp {Rank: (.*) ((.*) points)} [::http::data $tok] match rank points]} {
      set clansys [list $rank $points [clock seconds]]
    } else {
      set clansys 0
    }
  }
  ::http::cleanup $tok
}
proc pub:getrank {nick uh hand chan arg} {
  global clansys
  if {$clansys == "0"} {
    puthelp "PRIVMSG $chan :There was a problem last time I grabbed the rank - try again later"
    return
  }
  set ts [expr [clock seconds] - [lindex $clansys 2]]
  set t [expr $ts / 60] mins, [expr $ts % 60] seconds ago"
  puthelp "PRIVMSG $chan :Clan : Rank: [lindex $clansys 0] Points: [lindex $clansys 1] Updated: $t"
}
bind time - "01 *" time:getrank
bind pub - "!clanrank" pub:getrank
C
Commari

Post by Commari »

Ack!
Bad news again m8 :sad:
it says this:
TCL error [pub:getrank]: wrong # args: should be "set varName ?newValue?"

...
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Locate the line
set t [expr $ts / 60] mins, [expr $ts % 60] seconds ago"
and change it to
set t "[expr $ts / 60] mins, [expr $ts % 60] seconds ago"
C
Commari

Post by Commari »

:smile:))
It works!
It actually works :smile:)
Cheers ppslim

PS. Do u have time to update that script?
If needed...

But thx!
S
SkiRmiS

Post by SkiRmiS »

ppslim, if yuo get 1 $ after each writed script, yuo would be a milionaire :]]]
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

You offering to pay me?? :razz:
M
MaJiK

Post by MaJiK »

Hi ppslim - great script, I have seen it working in Commari's channel #clan.rok.
I have tried to get it to work in my channel, but unfortunately I get the following errors:

TCL error [time:getrank]: invalid command name "::http::ncode"

The above seems to happen on the hour, when the script trys to get the info, then when I try to execute the command !clanrank, I get the following:

TCL error [pub:getrank]: can't read "clansys": no such variable

I would really appreciate any help anyone can give me with this.
--------
On another note, if I do eventually get it working, I was wondering if you could add a command based on the original.
It would be great if you could call !nextwar to print the details clanbase automatically updates with the follwing URL http://www.clanbase.com/cbjswarupcoming.php?cid=59053 - this in turn generates the first line on the following page - http://www.unrealtournament.co.uk/flatl ... atches.htm

Please, Please Please, if you get a spare moment could someone help me out with this, I would be forever grateful.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The errors are actualy covered by one problem.

It seems that the HTTP package TCL is loading, is too old. I recomend 2.3

You can download it from http://www.ppslim.ukshells.co.uk/netbots/http.tcl and install it as a normal TCL script. Note, make sure you load the http.tcl script, before the clan script.
M
MaJiK

Post by MaJiK »

Thanks for the advice ppslim.
I downloaded and tried to install the updated http.tcl, but now I am getting a conflict:

conflicting versions provided for package "http": 2.0, then 2.3
while executing
"package provide http 2.3"
(file "scripts/http.tcl" line 23)
invoked from within
"source scripts/http.tcl"

How can I remove the older http.tcl ?

M
MaJiK

Post by MaJiK »

Soory ppslim.
I moved the http.tcl down the list a little more and it worked (I think). Now on the hour, when it trrys to get the information I get the following error:

TCL error [time:getrank]: bad option "equal": must be compare, first, index, last, length, match, range, tolower, toupper, trim, trimleft, trimright, wordend, or wordstart

What am I doing wrong now :sad:
Sorry to be a pain - but I would really like this script.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

This is all down to an old version of TCL, I sugest updating to a newer version.

Ask your shell admin if he could privde a newer version, or at least install it for use.
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

As a temp. fix, string match should work.
M
MaJiK

Post by MaJiK »

Sounds great, but where do I make the changes, I dont even see "equals" in the whole script ?
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

Id bet its probobly in that http tcl. errorInfo reports the error as caused by the proc that called it...
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

As sugested, this is caused by the HTTP TCL.

The HTTP TCL is provided as part of TCL, so it is sugested that you upgrade as permanent fix, let alone a temp fix.

A temp fix in this situation is most lekely to cause problems.
Locked