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.

ChannelUserStats for the homepage

Old posts that have not been replied to for several years.
Locked
S
SusanParker

ChannelUserStats for the homepage

Post by SusanParker »

I need a simple TCL-Script which let the eggdrop write the current USerStats of a Channel into a txt or php-File. ( with updates)
So that I can inlcude it on my page.

Example:
#Channelblah @Operator @loser StatBot @Chephren
So the bot should write into a file names count.php , the
Number
"4"
When someone joins the Chan , the Bot should uptade the informations.

I tried to "code" a script like that, but ... no success.
With mirc it´s no problem :
/write counter $nick($chan,0)

But I need it in TCL, couse my Bot should do this work

A lot of peole say , that this is very easy to code ;) But noone can help me :) That´s IRC: )

Thanks
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

you can try stats.mod, it makes livestat (allway updated), and u can (if u don't like the style) parse it easy with php.

or you check out lusers.tcl from DAWG and rewrite it...
S
SusanParker

Post by SusanParker »

I tried it too, but there is to much nonsensen.
Okjay, there are licestats and so on :)
But I cant see an entry how many people are in the chan.

I just need a lame number in a lame file :(
But I am not able to create it, thats lame, too ;)
M
Mapherick

Post by Mapherick »

There you go!

Code: Select all

# FILENAME: CHANCOUNT.TCL
# VERSION:  0.8 (BETA)
# DATE:     8/18/2002
# AUTHOR:   Mapherick^ApL <mapherick at apl-productions.org>
# PURPOSE:  To puts the current number of people in a predefined (list of) channel(s)

# $cc_outptfile: filename to write to
# $cc_outptpath: path to outputfile from your eggdrop dir
set cc_outptpath ""
set cc_outptfile "numusers.dat"

# $cc_chanlist
# List of channels to monitor (ommit #)
set cc_chanlist {my_chan_1 my_chan_2 my_chan_3}

bind join - * cc_join
bind part - * cc_part
bind sign - * cc_sign

proc cc_countusers {chan} {
  global cc_outptfile cc_outptpath

  set cc_numusers 0
  set cc_nicks [chanlist "\#$chan"]
  foreach n $cc_nicks {incr cc_numusers}

  set c [catch {set fd [open "$cc_outptpath$chan.$cc_outptfile" w]} reason]

  if $c {
    set msg "CHANCOUNT.TCL: ERROR: Error opening outpt file"
    putlog $msg
    catch {if [info exists fd] {close $fd}}
    return 0
  } else {
    puts $fd $cc_numusers
    catch {close $fd}
  }
  return 0
}

proc cc_join {nick uhost handle chan} {
  regsub -all "\#" $chan "" chan
  global cc_chanlist
  if {[lsearch $cc_chanlist $chan] != -1} {cc_countusers $chan}
  return 0
}
proc cc_part {nick uhost handle chan msg} {
  regsub -all "\#" $chan "" chan
  global cc_chanlist
  if {[lsearch $cc_chanlist $chan] != -1} {cc_countusers $chan}
  return 0
}

proc cc_sign {nick uhost handle chan msg} {
  regsub -all "\#" $chan "" chan
  global cc_chanlist
  if {[lsearch $cc_chanlist $chan] != -1} {cc_countusers $chan} 
  return 0
}
Tested most of it (its not so much)

Enjoy!
S
SusanParker

Post by SusanParker »

Wow, thx for the script.

Bu I am to lame :roll:

I set the path, the filename and the Chan .
The script has been laoded , but the bot doesnßt create a File.

So I create a file and playes withe the Chmods. I gave it all rights
first 775 then 777 , no success.
Same with the subDirectory.

The bot says no error.

Chans are without "#" .
M
Mapherick

Post by Mapherick »

the lame script's lame outputfile should be [lame channel name].[lame name you specified] and is generated on lame joins/parts/quits. Kinda lame, eh? :D
S
SusanParker

Post by SusanParker »

Yes I am .... U know what I am.
:)
I have found the files.
SOOOOOORRRY :) and THANKS :)
Have a nice .... day/week , whatever ;)

--
SusanParker
Locked