mIRC Home    About    Download    Register    News    Help

Print Thread
#93477 10/08/04 02:33 AM
Joined: Feb 2003
Posts: 83
L
LO_KEY Offline OP
Babel fish
OP Offline
Babel fish
L
Joined: Feb 2003
Posts: 83
Im Tryna Find An Avrg Ppl Are Online...

i got the first time i seen them join
the last time i seen them join
and the $ticks total they been on...

Code:
 
$round( $calc( $calc( %ticks  / $calc( $round( $calc( $calc( $ctime( %lastseen ) - $ctime( %1stseen ) ) / 86400) ,0) * 86400)) * 100 ) ,2) $+ % <<-- Perc Online


those vars = this
9/8/04 7:01:10 <<-- First Date
9/8/04 7:31:50 <<-- Last Date
808 <<--Ticks

Not Sure that the info i have is all i need, i think so, but any suggestions would be helpful

Any Help Would Be Greatly Appreciated. Thx In Advance


any help would make me happy
#93478 10/08/04 12:59 PM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
To calculate an average, you will need, their Join Time, Part/Quit Time, and How many times they have joined in total, if thats what your after, see an example full script below.

If however you just want the difference, you need Join time, and part/quit time and the following:

$duration($calc($ctime([color:red]QUIT/PART-TIME) - $ctime(JOINTIME)))[/color]

i.e. $duration($calc($ctime(9/8/04 7:31:50) - $ctime(9/8/04 7:01:10)))

A full example, of a script to gather average online times, replacing the red only, trigger is !avgtime [nickname].


alias avgtime.channel { return [color:red]#channel1 #channel2
}

alias avgtime {
if (!$hget(avgtime)) {
hmake avgtime 5000
if ($file(avgtime.hash)) { hload avgtime $+(",$mircdir,avgtime.hash,") }
}
else { hsave -o avgtime avgtime.hash }
}

On *:Join:#:{
if (($istok($avgtime.channel,$chan,32)) && (!$hget(tmpavgtime,$nick))) {
avgtime
hadd -m tmpavgtime $nick $ctime
hinc -m avgtime $+($nick,.visits) 1
}
}

On !*:Part:#:{
if (($istok($avgtime.channel,$chan,32)) && ($hget(tmpavgtime,$nick))) {
avgtime
hinc -m avgtime $nick $calc($ctime - $hget(tmpavgtime,$nick))
.hdel tmpavgtime $nick
}
}

On !*:Quit:{
var %i = $comchan($nick,0)
while (%i) {
if (($istok($avgtime.channel,$comchan($nick,%i),32)) && ($hget(tmpavgtime,$nick))) {
avgtime
hinc -m avgtime $nick $calc($ctime - $hget(tmpavgtime,$nick))
.hdel tmpavgtime $nick
return
}
dec %i
}
}

On !*:Text:!avgtime*:#:{
var %avgnick $iif($2,$2,$nick)

if (!$hget(avgtime,%avgnick)) {
if ($hget(tmpavgtime,%avgnick)) { msg $chan This is %avgnick $+ 's first visit, and has been here for, $duration($calc($ctime - $ifmatch)) }
else { msg $chan I have no record of, %avgnick $+ . }
}

else {
var %tmp = $calc($ctime - $hget(tmpavgtime,%avgnick))
if ((!%tmp) || (!$hget(tmpavgtime,%avgnick))) { %tmp = 0 }
msg $chan %avgnick has visited $calc($hget(avgtime,$+(%avgnick,.visits)) + 1) time(s), $iif(%tmp > 0,and has been here for $duration(%tmp) this visit) averaging, $duration($calc(($hget(avgtime,%avgnick) + %tmp) / $calc($hget(avgtime,$+(%avgnick,.visits)) + 1))) per visit.
}
}
[/color]

Eamonn.

#93479 10/08/04 06:08 PM
Joined: Feb 2003
Posts: 83
L
LO_KEY Offline OP
Babel fish
OP Offline
Babel fish
L
Joined: Feb 2003
Posts: 83
ok this is the info i have...

total joins

First time they joined

Last TIme They Joined

&

for each time they joined then quit/part the ticks between the join and part

ex. if they joined at 3:30 and 25 sec on Aug 9th and left 3:31 an 00 sec, then the tick for that would be 35, so it would add 35 to what there previous ticks were

this should be all info i need to figure out how long they are online in avrg overall, correct ?


any help would make me happy
#93480 10/08/04 07:04 PM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
You need the total number of times they have connected, and the total online time.

$calc(totaltime / totalconnections)

try the script above as an example.

Eamonn.

#93481 10/08/04 09:22 PM
Joined: Feb 2003
Posts: 83
L
LO_KEY Offline OP
Babel fish
OP Offline
Babel fish
L
Joined: Feb 2003
Posts: 83
Not sure how else to explain it, but usin what u jus showed really didnt work... and i cant understand hash tables so the prev script isnt helpn. wink

i dont want an avrg of per visit, i want it to be an avrg of overall online time compared to overall non-online time


any help would make me happy

Link Copied to Clipboard