egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Checking every xx Minutes channel and Count Users

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
erderiko
Voice


Joined: 16 Feb 2016
Posts: 2

PostPosted: Tue Feb 16, 2016 2:37 pm    Post subject: Checking every xx Minutes channel and Count Users Reply with quote

Hello I want to create a TCL Script for my eggodrop 1.6.

I want to create a timer that every xx minutes loop over nicks in channel
and count users with specific realname and write it to a file.
Code:

foreach nick [chanlist $chan] {
  if {match nick!REALNAME "mibbit"}{
      count++
  }
};

How can I do this i readed some documents and found nothing about realname. I can count on host but how can I do this on realname?
Back to top
View user's profile Send private message
erderiko
Voice


Joined: 16 Feb 2016
Posts: 2

PostPosted: Sun Feb 21, 2016 12:39 pm    Post subject: Reply with quote

Code:

bind time - "?5 *" checknicks ; #every 10 min
bind RAW - 311 checkrealname


set mibbit 0
set total 0


proc checknicks {args} {     
   global mibbit  total
    set chan "#chan" 
   set file "stats.txt"
   set time_now      [clock seconds]
   set time_formated   [clock format $time_now -format {%Y-%m-%d %H:%M:%S} -gmt true]
   set fs [open $file a+]
   puts $fs "$time_formated;$mibbit;$total"
   close $fs
   set mibbit 0

   
   putlog "perform checknick"
   foreach nick [chanlist $chan] {
      putquick "WHOIS $nick $nick"
   }         
    return 1                           
}

proc checkrealname { from keyword arguments } {
   global  mibbit total
   set fullname [string range [join [lrange $arguments 5 end]] 1 end]

   set realname3 "*www.mibbit.com*"

   if {[string match $realname3 $fullname]} {      
      incr kiwi
   }

   incr total
}


putlog "CheckNicks is loaded"


I'v solved by the above code but It only counts 300 nicknames how can I increase the queue?
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sun Feb 21, 2016 3:52 pm    Post subject: Reply with quote

Wow, you have a channel with over 300 users?
GoodJob on the channel:)
Not so much with the script...

erderiko wrote:
I'v solved by the above code but It only counts 300 nicknames how can I increase the queue?


The short answer is: Increase the time between each of the calls to proc checknicks

The longer explanation is:
The default for sending lines to the server from all eggdrop queues is "every 2 seconds".
10 minutes is 600 seconds (10 * 60 = 600)....
300 sends from queue is also 600 seconds (300 * 2 = 600)...

At that point, the 10 minutes expires, the proc checknicks runs again, the file is saved with the current count (300) and the count is reset to zero (0).
The counting then starts incrementing from 0 again, as the putquick queue grows in size some (it never has a chance to empty before filling it again).

Some notes about this entire script idea...
Any bot running this script will have no time to do anything else as its putquick queue will always be full/overfull.
After the script runs for a while, the putquick queue will get bigger with every new 10 minute call to proc checknicks, and the bot will probably die.

And what's this line of code all about?
Code:
      incr kiwi
judging by the rest of the code, you mean
Code:
      incr mibbit


Also looks like $total never gets reset back to 0 and would just keep getting larger with every new write to the file.

There may be other scripting issues I haven't noticed yet...

Closing thoughts: I don't think it's a good idea to have a bot pounding the server every 2 seconds for the entire time it's connected.
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Mon Feb 22, 2016 3:00 am    Post subject: Reply with quote

Why don't you use /WHO #channel instead of whois-ing each individual user?

You get a reply in raw 352 with results and raw 315 is triggered when the list ends.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber