mIRC Home    About    Download    Register    News    Help

Print Thread
need help with calculate. #245242 14/04/14 05:40 AM
Joined: Apr 2014
Posts: 13
T
Tarekhere Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Apr 2014
Posts: 13
I know this sounds too much but I need it really.

I need an mirc script that will calculate how much time each op in my room spends time with +o mode .. and save it to a file as I want 2 know how many time each op spends opping the room, and i want a command to view them while im away from my computer, like i've added my self to userlist as admin.

Thanks a lot in advance

Re: need help with calculate. [Re: Tarekhere] #245243 14/04/14 09:17 AM
Joined: Mar 2014
Posts: 72
A
AllDayGrinding Offline
Babel fish
Offline
Babel fish
A
Joined: Mar 2014
Posts: 72
You could maybe make a Points code then It saves all the points in the mIRC folder so it says how many points they have as you get points every 10 Mins or so

Re: need help with calculate. [Re: AllDayGrinding] #245270 14/04/14 09:32 PM
Joined: Apr 2014
Posts: 13
T
Tarekhere Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Apr 2014
Posts: 13
i dont really know how 2 do that ..

Re: need help with calculate. [Re: Tarekhere] #245272 14/04/14 10:50 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
I was expecting someone more experienced to do this for you. But I'll give it a shot.

What this code will do is every time your ops will join the channel, it'll start a timer adding a second counter to an ini file on your computer. You can read this file to see how many seconds they've spent later on.

Code:
alias add.sec {
  writeini -n Optimes.ini $1 Seconds $calc($readini(Optimes.ini,$1,Seconds) + 5)
}

on *:text:!optime*:#: { 
  if ($2 == $null) { msg # $nick has spent $readini(Optimes.ini,$nick,Seconds) seconds as an op. | return }
  else { msg # $2 has spent $readini(Optimes.ini,$2,Seconds) seconds as an op. }
}

on *:join:#: 
if ($istok(%ops,$nick,32)) $+(.timersec.,$nick) 0 5 add.sec $nick

on *:text:*:#: { 
  if ($nick !isop #) return
  if ($istok(%ops,$nick,32)) return
  set %ops $addtok(%ops,$nick,32)
}

on *:part:#: { 
  $+(.timersec.,$nick) off
}


It's untested but should work the way you want it to. If you want to you can start the timers differently, I just put it so when an op types in the chat he'll be put in the variable.
Note, this will only start the timer when they join, so if you put in the script, no timers will be started until you receive the notification that they have joined the channel.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: need help with calculate. [Re: Nillen] #245273 14/04/14 11:50 PM
Joined: Apr 2014
Posts: 13
T
Tarekhere Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Apr 2014
Posts: 13
Nillen thanks a lot for ur help .. but can it be edited to become on +o mode ?? not on join and part ??

and it returns for me this when i /add.sec
* /writeini: insufficient parameters (line 22, script4.mrc)

Last edited by Tarekhere; 14/04/14 11:56 PM.
Re: need help with calculate. [Re: Tarekhere] #245276 15/04/14 04:05 AM
Joined: Apr 2014
Posts: 191
B
blessing Offline
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Another way to check op.

It checks all user that has @op in the channel every 5 secs then write it to file.
When you type !optime user, it will inform you the time user has spent as an op.

It works for multi channel, !optime is per channel basis.

Code:
on *:join:#:if !$timer($+(opcheck.,#))  { $+(.timeropcheck.,#) 0 5 opcheck # }
on *:text:!optime *:#:if $nick isop # { optime # $iif($2,$2,$nick) 1 }

alias -l opcheck {
  if $me !ison $1 { $+(.timeropcheck.,$1) off | return }
  var %i 1
  while $nick($1,%i,o) { 
    optime $1 $v1 
    inc %i 
  }
}

alias -l optime {
    if $isfile(opfile.ini) { var %d $iif($readini(opfile.ini,$+(optime.,$1),$2),$v1,0) }
    else { var %d 0 }
    if $3 { msg $1 $2 has $iif(%d,spent $duration(%d) as an op.,no online record.) } 
    else { writeini opfile.ini $+(optime.,$1) $2 $calc(%d + 5) }
    return
}


- untested.

Re: need help with calculate. [Re: blessing] #245314 16/04/14 07:24 AM
Joined: Apr 2014
Posts: 13
T
Tarekhere Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Apr 2014
Posts: 13
ok i tested it and its working successfully, but I need 1 more thing, I need it to save records for only 1 channel, and i need it to save daily records and weekly records .. is that possible ?

Re: need help with calculate. [Re: Tarekhere] #245360 17/04/14 05:54 PM
Joined: Mar 2014
Posts: 52
P
patrickplays Offline
Babel fish
Offline
Babel fish
P
Joined: Mar 2014
Posts: 52
Code:
on *:join:#yourchannelhere:


this should work, i guess :s

Re: need help with calculate. [Re: Tarekhere] #245361 17/04/14 06:04 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Well, you'd have to make a timer that increases a variable every 24 hours, the variable should be used in a save context, so that the script saves to opfile $+ %x $+ .ini and the timer ups the %x.

Then you can make another remote command for instance to compile the past 7 files worth.

I dunno, that's what I'd do at least.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: need help with calculate. [Re: Nillen] #245579 28/04/14 12:24 PM
Joined: Apr 2014
Posts: 13
T
Tarekhere Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Apr 2014
Posts: 13
Originally Posted By: Nillen
Well, you'd have to make a timer that increases a variable every 24 hours, the variable should be used in a save context, so that the script saves to opfile $+ %x $+ .ini and the timer ups the %x.

Then you can make another remote command for instance to compile the past 7 files worth.

I dunno, that's what I'd do at least.



I dont know really how 2 do that frown

Re: need help with calculate. [Re: Tarekhere] #245585 28/04/14 05:01 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Add something like this to blessing's code
Code:
on *:join:#:if !$timer($+(opcheck.,#))  { $+(.timeropcheck.,#) 0 5 opcheck # }
on *:text:!optime *:#:if $nick isop # { optime # $iif($2,$2,$nick) 1 }

alias -l opcheck {
  if $me !ison $1 { $+(.timeropcheck.,$1) off | return }
  var %i 1
  while $nick($1,%i,o) { 
    optime $1 $v1 
    inc %i 
  }
}

alias -l optime {
  if $isfile(opfile.ini) { var %d $iif($readini(opfile.ini,$+(Week.,%x,.,$1),$2),$v1,0) }
  else { var %d 0 }
  if $3 { msg $1 $2 has $iif(%d,spent $duration(%d) as an op today.,no online record today.) } 
  else { writeini opfile.ini $+(Week.,%x,.,$1) $2 $calc(%d + 5) }
  return
}

alias -l dayup inc %x
alias dayupstart timer 0 86400 dayup
menu channel {
  Set Day { set %x $?="" }
  Start Day Timer { dayupstart }
  Manual Dayup { dayup }
}

You'll probably figure out how to do it better though.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net