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.

whosonline script (update on quit)

Old posts that have not been replied to for several years.
Locked
j
jjblade
Voice
Posts: 16
Joined: Sat Jul 24, 2004 5:23 am

whosonline script (update on quit)

Post by jjblade »

Im using the whosonline script below.
It works, except one thing.
If the user leaves the chat by cutting the connection, the script doesnt update the whosonline list.

Could you help me an tell how i get the script updating the whosonline list if someone´s quitting?
I´ve tried it with this block:

Code: Select all

# Check for a QUIT
proc hung_up {nick uhost handle chan msg} { 
  regsub -all "\#" $chan "" chan 
  global cc_chanlist 
  if {[lsearch $cc_chanlist $chan] != -1} {cc_countusers $chan} 
  return 0 
}
but it didn´t work.

TiA!

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 "../pjircapplet/whosonline/" 
set cc_outptfile "whosonline.txt" 

# $cc_chanlist 
# List of channels to monitor (ommit #) 
set cc_chanlist {sheepworld BlackSheep Seelsorge Flirtwiese Themenabend} 

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

proc cc_countusers {chan} { 
  global cc_outptfile cc_outptpath 

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

  set cc_numusers 0 
  set cc_nicks [chanlist "\#$chan"] 
  puts $fd [join $cc_nicks]
  foreach n $cc_nicks {
      incr cc_numusers
      } 
  
  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 
}

# Check for a QUIT
proc hung_up {nick uhost handle chan msg} { 
  regsub -all "\#" $chan "" chan 
  global cc_chanlist 
  if {[lsearch $cc_chanlist $chan] != -1} {cc_countusers $chan} 
  return 0 
}



putlog "\002WHOSONLINE:\002 whosonline.tcl Version1 is loaded."
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Basically what you can do, to make a simple channel user counting script and noting the channel usercount to a TXT file.

Binding on channel events such as

bind sign (users quitting a channel)
bind join (users joining a channel)
bind part (users parting a channel)
bind kick (users kicked from a channel)
bind splt (users splitting from a channel due to a network split)

These triggers will always make users join and leave from a channel which will affect the usercount (channel population).

You can make a script to count the channels population through the channel list command. :P

set totalusers [llength [chanlist #channel]] will count the total number of channel users.

You can bind all of these above events and then count the total number of users through the chanlist command open your defined txt file, write to it and close it. :wink:

ALSO:
What you can do is instead of binding to all events, you can use a timer or utimer to continuously check the channel usercount every X secs or X mins and then save the user count and write it to a txt file! :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
j
jjblade
Voice
Posts: 16
Joined: Sat Jul 24, 2004 5:23 am

Post by jjblade »

Hi!

Thank you.
I wrote all this events you´ve told me in my script and it works fine now!
Don´t even need the counter solution.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

No problem, just use the correct number of arguments. Each bind utilizes different numbers and types of arguments in their procedures! :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
D
Doos
Voice
Posts: 9
Joined: Thu Jul 07, 2005 11:31 am

Post by Doos »

I added:

bind kick - * cc_sign
bind splt - * cc_sign

to the above script.

It does create a nice little file with users when they join, just doesn't update it on /part /quit.
I'm totally new to tcl (perl background) and the tcl/eggdrop tutorial I find, well lets say hard to read.

Could the OP tell me how to make it work aswell, or someone else.

Thanks,

Doos
Locked