mIRC Home    About    Download    Register    News    Help

Print Thread
#170185 04/02/07 01:41 PM
Joined: Feb 2007
Posts: 10
N
Pikka bird
OP Offline
Pikka bird
N
Joined: Feb 2007
Posts: 10
Hello, I recently got a script and it is perfect but the only thing which I cannot code in is a nice little option which will clear the stats files from the mIRC folder.

Here is the code -

Code:
on *:TEXT:!ircstats*:#:{
  if (!$2) {
    %nm = $nick
  }
  else {
    %nm = $2
  }
  %line = $read(ircstats_actions.txt, s, %nm)
  if (%line != $null) {
    %actions = $remove(%line,%nm)
  }
  else {
    %actions = 0
  }
  %line = $read(ircstats_text.txt, s, %nm)
  if (%line != $null) {
    %text = $remove(%line,%nm)
  }
  else {
    %text = 0
  }
  %line = $read(ircstats_bans.txt, s, %nm)
  if (%line != $null) {
    %bans = $remove(%line,%nm)
  }
  else {
    %bans = 0
  }
  %line = $read(ircstats_unbans.txt, s, %nm)
  if (%line != $null) {
    %unbans = $remove(%line,%nm)
  }
  else {
    %unbans = 0
  }
  %line = $read(ircstats_kicks.txt, s, %nm)
  if (%line != $null) {
    %kicks = $remove(%line,%nm)
  }
  else {
    %kicks = 0
  }
  notice $nick IRC Stats for %nm on #Birdy 
  notice $nick Lines of Text: %text  ...  Actions: %actions ... Bans: %bans ... Unbans: %unbans ... Kicks: %kicks
}
on *:ACTION:*:#:{
  %line = $read(ircstats_actions.txt, s, $nick)
  if (%line != $null) {
    %current = $remove(%line,$nick)
  }
  else {
    %current = 0
  }
  %new = $calc(%current + 1)
  /write -ds $+ $nick ircstats_actions.txt
  /write ircstats_actions.txt $nick %new
}
on *:TEXT:*:#:{
  %line = $read(ircstats_text.txt, s, $nick)
  if (%line != $null) {
    %current = $remove(%line,$nick)
  }
  else {
    %current = 0
  }
  %new = $calc(%current + 1)
  /write -ds $+ $nick ircstats_text.txt
  /write ircstats_text.txt $nick %new
}
on *:BAN:#:{
  %line = $read(ircstats_bans.txt, s, $nick)
  if (%line != $null) {
    %current = $remove(%line,$nick)
  }
  else {
    %current = 0
  }
  %new = $calc(%current + 1)
  /write -ds $+ $nick ircstats_bans.txt
  /write ircstats_bans.txt $nick %new
}
on *:UNBAN:#:{
  %line = $read(ircstats_unbans.txt, s, $nick)
  if (%line != $null) {
    %current = $remove(%line,$nick)
  }
  else {
    %current = 0
  }
  %new = $calc(%current + 1)
  /write -ds $+ $nick ircstats_unbans.txt
  /write ircstats_unbans.txt $nick %new
}

on *:KICK:#:{
  %line = $read(ircstats_kicks.txt, s, $nick)
  if (%line != $null) {
    %current = $remove(%line,$nick)
  }
  else {
    %current = 0
  }
  %new = $calc(%current + 1)
  /write -ds $+ $nick ircstats_kicks.txt
  /write ircstats_kicks.txt $nick %new
}


Now, I would like two options for this, The two options being:

-!clearstats
-!clear <nickname>

Clear stats would clear all of the stats and clear nickname would obviously only clear the stats on that username.
I would like it if someone is possible to do this for me smile If only one of the options above can be coded by you then can you make it so that the !clearstats one works rather than just clearing someones username, if both can be done then that would be brill smile

Thanks
Ben

Joined: Apr 2006
Posts: 400
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
to clear a text file you could use
Code:
write -c FILENAME.TXT

can you paste some of the txt file on here so it would make it a little easier for me to see what you are looking to do.


-Kurdish_Assass1n
Joined: Feb 2007
Posts: 10
N
Pikka bird
OP Offline
Pikka bird
N
Joined: Feb 2007
Posts: 10
Originally Posted By: Kurdish_Assass1n
to clear a text file you could use
Code:
write -c FILENAME.TXT

can you paste some of the txt file on here so it would make it a little easier for me to see what you are looking to do.


There are a few files, Examples:

ircstats_actions.txt
Code:
Nightmare 16


ircstats_bans.txt
Code:
Nightmare 1


ircstats_kicks.txt
Code:
Nightmare 6 


ircstats_text.txt
Code:
Nightmare 837


ircstats_unbans.txt
Code:
Nightmare 1


When you do the !ircstats command in channel you get

Code:
[15:06:55] <Nightmare> !ircstats
[15:06:55] [Notice] -Bot`- IRC Stats for Nightmare on #Birdy
[15:06:55] [Notice] -Bot`- Lines of Text: 837 ... Actions: 16 ... Bans: 1 ... Unbans: 1 ... Kicks: 6

Joined: Nov 2015
Posts: 14
L
Pikka bird
Offline
Pikka bird
L
Joined: Nov 2015
Posts: 14
Good code, but I would like to know how it would be to measure users' online time.
for example:

[15:06:55] <Nightmare> !ircstats
[15:06:55] [Notice] -Bot`- IRC Stats for Nightmare on #Birdy
[15:06:55] [Notice] -Bot`- Lines of Text: 837 ... Actions: 16 ... Bans: 1 ... Unbans: 1 ... Kicks: 6 ... TimeONline: X


Link Copied to Clipboard