mIRC Homepage
Posted By: StriderGU Nick online time in channel - 28/05/03 11:38 AM
Have a property for $nick() to show online time simular to the idle time, but instead show the time the nick have been in the channel, and not just idle time.

Also can come in handy if $uptime could show the time since you joined a specific channel.
Posted By: theRat Re: Nick online time in channel - 28/05/03 12:46 PM
For what purpose would you use these? Those are easy to script if needed...
Posted By: StriderGU Re: Nick online time in channel - 28/05/03 12:48 PM
Then show me the easy scripts please.

To see the online time for all users in all channels.
Posted By: theRat Re: Nick online time in channel - 28/05/03 01:16 PM
Code:
on *:start: {
  hmake nickonline 500
}
on *:join:#: {
  if ( $nick == $me ) {
    enable #nickraws
  }
  hadd nickonline $+($cid,.,$chan,.,$nick) $ctime
}

#nickraws off
raw 366:*: {
  var %i = 1 , %j = $nick($2,0) , %ctime = $ctime
  while ( %i <= %j ) {
    hadd nickonline $+($cid,.,$2,.,$nick($2,%i)) %ctime
    inc %i
  }
  disable #nickraws
}
#nickraws end

on *:part: {
  if ( $nick == $me ) {
    hdel -w nickonline $+($cid,.,$chan,.,*)
  }
  else {
    hdel nickonline $+($cid,.,$chan,.,$nick)
  }
}
on *:nick: {
  ;was it $nick or $newnick you had to loop trough w/ $comchan???
  var %i = 1 , %j = $comchan($nick,0)
  while ( %i <= %j ) {
    hadd nickonline $+($cid,.,$comchan($nick,%i),.,$newnick) $hget(nickonline,$+($cid,.,$comchan($nick,%i),.,$nick)
    hdel nickonline $+($cid,.,$comchan($nick,%i),.,$nick)
    inc %i
  }
}
on *:quit: {
  var %i = 1 , %j = $comchan($nick,0)
  while ( %i <= %j ) {
    hdel nickonline $+($cid,.,$comchan($nick,%i),.,$nick)
    inc %i
  }
}
on *:disconnect: {
  hdel -w nickonline $cid $+ .*
}
;Aliases
alias nickonline {
  ;$1 = #channel
  ;$2 = nick
  ;$3 = cid, if omitted current $cid used
  if ( $isid ) {
    return $calc($ctime - $hget(nickonline,$+($iif($3,$3,$cid),.,$1,.,$2))
  }
}


something... not tested... but should give you idea what to do?
Posted By: StriderGU Re: Nick online time in channel - 28/05/03 01:43 PM
Thanks, will try it out. Will take a bit time for me to understand it full but I think I will eventually.

But still a new property would be nice to have in $nick() don't you think?
Posted By: theRat Re: Nick online time in channel - 28/05/03 01:50 PM
alias nick {
if ( $prop == online ) {
return $nickonline($1,$2)
}
else {
return [ $nick($1,$2,$3,$4) [ $+ $prop ] ]
}
}

or smthng smile
Posted By: Rich Re: Nick online time in channel - 28/05/03 06:30 PM
Nice try, but (unfortunately) you can't overwrite mIRC identifiers, only commands.
(I found that out the time-consuming way myself)
Posted By: StriderGU Re: Nick online time in channel - 29/05/03 02:44 PM
Ok it works now, thanks a bunch theRat.

I just had to use $newnick instead of $nick in $comchan like you maybe thought.


Edit: Hm doesn't seam to reset the time if someone rejoins (parts and join).
© mIRC Discussion Forums