| View previous topic :: View next topic |
| Author |
Message |
erderiko Voice
Joined: 16 Feb 2016 Posts: 2
|
Posted: Tue Feb 16, 2016 2:37 pm Post subject: Checking every xx Minutes channel and Count Users |
|
|
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 |
|
 |
erderiko Voice
Joined: 16 Feb 2016 Posts: 2
|
Posted: Sun Feb 21, 2016 12:39 pm Post subject: |
|
|
| 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 |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Feb 21, 2016 3:52 pm Post subject: |
|
|
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?judging by the rest of the code, you mean
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 |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Feb 22, 2016 3:00 am Post subject: |
|
|
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 |
|
 |
|