|
Joined: May 2013
Posts: 140
Vogon poet
|
OP
Vogon poet
Joined: May 2013
Posts: 140 |
I have a channel stats script that works fine except that no one can delete stats for a user based on this; IF ($1 == %c $+ delstats) && ($2) && ($level($address($nick,2)) == 500) { remove-stats-nick $network $+ @ $+ $chan $+ @ $+ $2 .msg $chan Stats vir nick $2 is verwyder in opdrag van Eienaars }
I want to give that to all ops something like if IF ($1 == %c $+ clearstats) && ($nick isop $chan) {
Only that does not work probably the $nick Should be the ops nick to clear the stats. I have also tried to change the 500 to 100 Any ideas please
|
|
|
|
Joined: Jul 2014
Posts: 313
Pan-dimensional mouse
|
Pan-dimensional mouse
Joined: Jul 2014
Posts: 313 |
Hi raycomp, Check if this is what you want: In this way, the event will only be executed by ops with level 500:
on ^*:text:*:#:{
if ($1 == %c $+ delstats) && ($2) && ($level($address($nick,2)) == 500) {
if ($nick isop $chan) {
remove-stats-nick $network $+ @ $+ $chan $+ @ $+ $2
.msg $chan Stats vir nick $2 is verwyder in opdrag van Eienaars
}
}
}
If you want all operators to have access to this event without an access level, then the code will look like this:
on ^*:text:*:#:{
if ($1 == %c $+ delstats) && ($2) && ($nick isop $chan) {
remove-stats-nick $network $+ @ $+ $chan $+ @ $+ $2
.msg $chan Stats vir nick $2 is verwyder in opdrag van Eienaars
}
}
Last edited by TECO; 22/03/20 03:22 AM.
TECO irc.PTirc.org (Co-Admin)
|
|
|
|
Joined: May 2013
Posts: 140
Vogon poet
|
OP
Vogon poet
Joined: May 2013
Posts: 140 |
thank you very much
Another question the clearstats should be executed at month end. Any ideas on how to automate that. a timer or some script? otherwise every 30days
Last edited by raycomp; 22/03/20 11:06 AM.
|
|
|
|
Joined: Jul 2014
Posts: 313
Pan-dimensional mouse
|
Pan-dimensional mouse
Joined: Jul 2014
Posts: 313 |
thank you very much
Another question the clearstats should be executed at month end. Any ideas on how to automate that. a timer or some script? otherwise every 30days But do you already have the code Or do you want the code to be made? If you have a code for this feat but you want to add the cleaning after 30 days, show me the code you have.
TECO irc.PTirc.org (Co-Admin)
|
|
|
|
Joined: May 2013
Posts: 140
Vogon poet
|
OP
Vogon poet
Joined: May 2013
Posts: 140 |
Teco script as requested * Commands: stats [nick] => Overall stats for $nick|$2 in $network@#skinnerbekChannel tstats [nick] => Today's stats about $nick|$2 top10 => Overall top 10 chatters in $network@channel ttop10 => Today's top 10 chatters in $network@channel delstats <nick> => Removing statistics about $2 in $network@channel clearstats => Removing all statistics collected for $network@channel */
;======================================= ALIAS -l StatsFile return monthlystats- $+ $asctime(yyyy-mm) $+ .txt On *:Event: { write $StatsFile some statistic msg $chan new statsfile created }
ON *:TEXT:!Name*:#Skinnerbek: { writeini -n register.ini $chan $+ ~ $+ $nick Name $2- writeini -n register.ini $chan $+ ~ $+ $nick Register on notice $nick Your character name is registered. Step 2: $2- $+ , Get ready for more! } ;=============================================
ON *:TEXT:*:#: { if %stats_module == On {
if (Guest* iswm $nick) return if ($nick == Services) return if $nick == skinnerbek) return IF ($1 == %c $+ top10) { IF (%stats_floodpro >= 3) { halt } inc -u30 %stats_floodpro 1 msg $chan $maketop10($network $+ @ $+ $chan) unset %stats_top10_* window -c @top10source } IF ($1 == %c $+ ttop10) { IF (%stats_floodpro >= 3) { halt } inc -u30 %stats_floodpro 1 msg $chan $maketodaytop10($network $+ @ $+ $chan) unset %stats_top10_* window -c @top10source } IF ($1 == %c $+ stats) { IF (%stats_floodpro >= 3) { halt } inc -u30 %stats_floodpro 1 IF ($2) { msg $chan $getstats($network $+ @ $+ $chan $+ @ $+ $2) } IF (!$2) { msg $chan $getstats($network $+ @ $+ $chan $+ @ $+ $nick) } } IF ($1 == %c $+ tstats) { IF (%stats_floodpro >= 3) { halt } inc -u30 %stats_floodpro 1 IF ($2) { msg $chan $gettodaystats($network $+ @ $+ $chan $+ @ $+ $2) } IF (!$2) { msg $chan $gettodaystats($network $+ @ $+ $chan $+ @ $+ $nick) } } ;IF ($1 == %c $+ delstats) && ($2) && ($level($address($nick,2)) == 100) { IF ($1 == %c $+ delstats) { remove-stats-nick $network $+ @ $+ $chan $+ @ $+ $2 .msg $chan Stats vir nick $2 is verwyder in opdrag van Eienaars } IF ($1 == %c $+ clearstats) && ($level($address($nick,2)) == 500) { ;IF ($1 == %c $+ delstats) && ($2) = AbleMan { remove-stats-channel $network $+ @ $+ $chan .msg $chan Channelstats erased. } IF ($left($1,1) == %c) {
hinc -m totalcommands $network $+ @ $+ $chan $+ @ $+ $nick 1 hinc -m todaytotalcommands $network $+ @ $+ $chan $+ @ $+ $nick 1 } hinc -m totalwords $network $+ @ $+ $chan $+ @ $+ $nick $numtok($1-,32) hinc -m totalletters $network $+ @ $+ $chan $+ @ $+ $nick $len($1-) hinc -m totallines $network $+ @ $+ $chan $+ @ $+ $nick 1
hinc -m todaytotalwords $network $+ @ $+ $chan $+ @ $+ $nick $numtok($1-,32) hinc -m todaytotalletters $network $+ @ $+ $chan $+ @ $+ $nick $len($1-) hinc -m todaytotallines $network $+ @ $+ $chan $+ @ $+ $nick 1 } } ; Action counting ; Will add all used words in action to the total spoken words as well
ON *:ACTION:*:#: { if ($nick == $me) return if ($nick == Services) || ($nick == skinnerbek) return if (Guest* iswm $nick) return if %stats_module == on { hinc -m totalactions $network $+ @ $+ $chan $+ @ $+ $nick 1 hinc -m totalwords $network $+ @ $+ $chan $+ @ $+ $nick $numtok($1-,32) hinc -m totalletters $network $+ @ $+ $chan $+ @ $+ $nick $len($1-) ;-- hinc -m todaytotalactions $network $+ @ $+ $chan $+ @ $+ $nick 1 hinc -m todaytotalwords $network $+ @ $+ $chan $+ @ $+ $nick $numtok($1-,32) hinc -m todaytotalletters $network $+ @ $+ $chan $+ @ $+ $nick $len($1-) } }
alias clearstats { var %stats_clearconfirm = $input (Are you sure to delete data?) IF (%stats_clearconfirm == $yes) { hfree -sw total* hmake totalwords 1 hmake totalletters 10 hmake totalcommands 10 hmake totalactions 10 hmake totallines 10 todaystatclear } }
;====================================== ON *:TEXT:!clearstats1*:#: { var %stats_clearconfirm = $input (Are you sure to delete data?) IF (%stats_clearconfirm == $yes) { hfree -sw total* hmake totalwords 1 hmake totalletters 10 hmake totalcommands 10 hmake totalactions 10 hmake totallines 10 todaystatclear } } ;=================================================
ALIAS remove-stats-nick { var %stats-remnick = $1 $+ * hdel -w totalwords %stats-remnick hdel -w totalletters %stats-remnick hdel -w totalcommands %stats-remnick hdel -w totalactions %stats-remnick hdel -w totallines %stats-remnick hdel -w todaytotalwords %stats-remnick hdel -w todaytotalletters %stats-remnick hdel -w todaytotalcommands %stats-remnick hdel -w todaytotalactions %stats-remnick hdel -w todaytotallines %stats-remnick statsave }
ALIAS remove-stats-channel { var %stats-remchan = $1 $+ * hdel -w totalwords %stats-remchan hdel -w totalletters %stats-remchan hdel -w totalcommands %stats-remchan hdel -w totalactions %stats-remchan hdel -w totallines %stats-remchan hdel -w todaytotalwords %stats-remchan hdel -w todaytotalletters %stats-remchan hdel -w todaytotalcommands %stats-remchan hdel -w todaytotalactions %stats-remchan hdel -w todaytotallines %stats-remchan statsave }
ALIAS getstats { IF ($hget(totalwords, $1) != $null) { IF ($hget(totalwords, $1) != $null) { var %t.words = $hget(totalwords, $1) } ELSE { var %t.words = 0 } IF ($hget(totalletters, $1) != $null) { var %t.letters = $hget(totalletters, $1) } ELSE { var %t.letters = 0 } IF ($hget(totalcommands, $1) != $null) { var %t.commands = $hget(totalcommands, $1) } ELSE { var %t.commands = 0 } IF ($hget(totallines, $1) != $null) { var %t.lines = $hget(totallines, $1) } ELSE { var %t.lines = 0 } IF ($hget(totalactions, $1)) { var %t.actions = $hget(totalactions, $1) } ELSE { var %t.actions = 0 } return [ $+ $gettok($1,3,64) $+ ] Words used: %t.words ( $+ %t.letters letters) Commands: %t.commands $+ . %t.lines lines and %t.actions actions. halt } return 1 $gettok($1,3,64) was very quite up till now! halt }
ALIAS gettodaystats { IF ($hget(todaytotalwords, $1) != $null) { IF ($hget(todaytotalwords, $1) != $null) { var %t.words = $hget(todaytotalwords, $1) } ELSE { var %t.words = 0 } IF ($hget(todaytotalletters, $1) != $null) { var %t.letters = $hget(todaytotalletters, $1) } ELSE { var %t.letters = 0 } IF ($hget(todaytotalcommands, $1) != $null) { var %t.commands = $hget(todaytotalcommands, $1) } ELSE { var %t.commands = 0 } IF ($hget(todaytotallines, $1) != $null) { var %t.lines = $hget(todaytotallines, $1) } ELSE { var %t.lines = 0 } IF ($hget(todaytotalactions, $1)) { var %t.actions = $hget(todaytotalactions, $1) } ELSE { var %t.actions = 0 } return [ $+ $gettok($1,3,64) $+ ] Words used today %t.words ( $+ %t.letters letters) commands used %t.commands $+ . %t.lines lines and %t.actions actions. halt } return 1 $gettok($1,3,64) war very quite up to now! halt }
ALIAS maketop10 { ; Save the hash table into .dat ; I know that this will make answer delayed especially in bigger channels... but well.... i dont care. ; This is about the best way to ensure that we will get the most recent result and also to ensure that we have backup of the hashtables. statsave ; Loading total spoken words into window window -hk0n @top10source clear @top10source var %stats_findbegin = $read(chanstats.dat, s, [totalwords]) var %stats_looppoint = $calc($readn + 1 ) WHILE (!%stats_loophalt) { var %stats_putline = $read(chanstats.dat, %stats_looppoint) IF ($left(%stats_putline,1) != $chr(91)) && ($left(%stats_putline,$len($1)) == $1) { var %statscleanline = $gettok($read(chanstats.dat, %stats_looppoint),3,64) aline @top10source %statscleanline } ELSEIF ($left(%stats_putline,1) == $chr(91)) { var %stats_loophalt = true } inc %stats_looppoint } ; Filtering the window filter -cetuww 2 61 @top10source @top10source * ; Now lets read the first 10 lines and store it to variables (%stats_top10_xx) ; Thats it if we have 10 lines of course ; If we have less then we will output only existing numbers of lines. var %stats_loop10 = 1 WHILE (!%statssecondloophalt) { IF ($line(@top10source, %stats_loop10)) { set -e %stats_top10_ [ $+ [ %stats_loop10 ] ] $gettok($line(@top10source, %stats_loop10),1,61) ( $+ $gettok($line(@top10source, %stats_loop10),2,61) $+ ) inc %stats_loop10 } IF (!$line(@top10source, %stats_loop10)) || (%stats_loop10 >= 11) { var %statssecondloophalt = true } } IF (%stats_loop10 != 12) { var %stats_loop10 = $calc(%stats_loop10 - 1) } return This months top10 %stats_loop10 users Total words: %stats_top10_1 %stats_top10_2 %stats_top10_3 %stats_top10_4 %stats_top10_5 %stats_top10_6 %stats_top10_7 %stats_top10_8 %stats_top10_9 %stats_top10_10
}
ALIAS maketodaytop10 { window -hk0n @top10source clear @top10source hsave -i todaytotalwords tempstats.dat totalwords var %stats_loopline = 1 WHILE (%stats_loopline <= $lines(tempstats.dat)) { IF ($gettok($read(tempstats.dat,%stats_loopline),1,64) == $gettok($1,1,64)) && ($gettok($read(tempstats.dat,%stats_loopline),2,64) == $gettok($1,2,64)) { aline -p @top10source $gettok($read(tempstats.dat,%stats_loopline),3,64) } inc %stats_loopline } filter -cetuww 2 61 @top10source @top10source * var %stats_loop10 = 1 WHILE (!%statssecondloophalt) { IF ($line(@top10source, %stats_loop10)) { set -e %stats_top10_ [ $+ [ %stats_loop10 ] ] $gettok($line(@top10source, %stats_loop10),1,61) ( $+ $gettok($line(@top10source, %stats_loop10),2,61) $+ ) inc %stats_loop10 } IF (!$line(@top10source, %stats_loop10)) || (%stats_loop10 >= 11) { var %statssecondloophalt = true } } IF (%stats_loop10 != 12) { var %stats_loop10 = $calc(%stats_loop10 - 1) } .remove tempstats.dat return Vandag se top %stats_loop10 users as per total words: %stats_top10_1 %stats_top10_2 %stats_top10_3 %stats_top10_4 %stats_top10_5 %stats_top10_6 %stats_top10_7 %stats_top10_8 %stats_top10_9 %stats_top10_10 }
ON *:EXIT: { echo -a Leaving networks to reset daily stats! statsave /timerstart -o 00:00 1 20 /server }
ON *:CONNECT: { statload if (%stats_module == $null) set %stats_module on dailystatsflush echo -a Connected to network $network to accumelate daily stats }
ALIAS dailystatsflush { todaystatclear msg #ops Todays stats for network /timerstop -o 23:59 1 60 EXIT }
ALIAS statsave { hsave -i totalwords chanstats.dat totalwords hsave -i totalletters chanstats.dat totalletters hsave -i totalcommands chanstats.dat totalcommands hsave -i totalactions chanstats.dat totalactions hsave -i totallines chanstats.dat totallines /timerstart -o 00:00 1 20 /server }
ALIAS todaystatclear { hfree -w todaytotal* hmake todaytotalwords 10 hmake todaytotalletters 10 hmake todaytotalcommands 10 hmake todaytotalactions 10 hmake todaytotallines 10 }
ALIAS statload { hmake totalwords 10 hmake totalletters 10 hmake totalcommands 10 hmake totalactions 10 hmake totallines 10 hload -i totalwords chanstats.dat totalwords hload -i totalletters chanstats.dat totalletters hload -i totalcommands chanstats.dat totalcommands hload -i totalactions chanstats.dat totalactions hload -i totallines chanstats.dat totallines }
|
|
|
|
Joined: Jul 2014
Posts: 313
Pan-dimensional mouse
|
Pan-dimensional mouse
Joined: Jul 2014
Posts: 313 |
I hope this little code does what you want every 30 days.
ON *:CONNECT: {
if (!%datestats) { set %datestats $date }
checkdays
.timercheckdays -io 0 3600 checkdays
}
ALIAS checkdays {
var %wks = $deltok($duration($calc($ctime($date) - $ctime(%datestats))),2-,32), %wks = $remove(%wks,wk,s)
if (%wks >= 4) {
remove-stats-channel $network $+ @ $+ $chan
set %datestats $date
}
}
Last edited by TECO; 28/03/20 01:21 AM.
TECO irc.PTirc.org (Co-Admin)
|
|
|
|
Joined: Jul 2014
Posts: 313
Pan-dimensional mouse
|
Pan-dimensional mouse
Joined: Jul 2014
Posts: 313 |
In this line:
remove-stats-channel $network $+ @ $+ $chan
Alter for this:
remove-stats-channel $network $+ @ $+ #Skinnerbek
TECO irc.PTirc.org (Co-Admin)
|
|
|
|
|