mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 20
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Feb 2003
Posts: 20
I'm trying to keep track of the time users spend in my channel but have run into a problem with my idea on how to do this.

My plan was to set a variable on join and calculate how much time passed when they parted or quit. This would accumulate on each visit cycle.

When they joined i would set the variable like....
set % $+ $nick $+ $ctime

Trying to recall that variable to make the calcultions is where I'm stuck. It seems wildcards can only be used for unsetting variables so something like this when they part/quits wont work.

inc %tt $+ $nick $+ $duration($calc($right(% $+ $nick*,10) - $ctime))

Any ideas on how to make this work? Or am I going about this all wrong?
Or if anyone has already made something similar and wouldnt mind sharing smile

Joined: Dec 2002
Posts: 169
J
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
Why not make the value of the variable the ctime instead of trying to include ctime in the variable name?

set $+(%,Join.,$cid,.,$chan,.,$nick) $ctime

Simple sample script
Code:
on *:join:#:{
  set $+(%,Join.,$cid,.,$chan,.,$nick) $ctime
}
on *:part:#:{
  var %ts = $eval($+(%,Join.,$cid,.,$chan,.,$nick),2)
  if (%ts) {
    echo 2 $chan $nick spent $duration($calc($ctime - %ts)) in the channel
    unset $+(%,Join.,$cid,.,$chan,.,$nick)
  }
}
To make it work you will have to put in an ON NICK event to handle when people switch nicks. You will need an ON QUIT event to handle quits (note: there is no $chan in ON QUIT. You have to loop through $comchan). Your script will also have to wipe out variables when you quit, part, and disconnect.

*EDIT*
You'll also need on ON KICK event.

Last edited by Jerk; 19/05/03 07:44 PM.

Link Copied to Clipboard