mIRC Homepage
Posted By: Marantz On connect and disconnect - 20/07/04 04:28 PM
I'm try to turn this into a multiserver type thing, but don't know where to start
i have
Code:
 on 1:CONNECT:{ set %tmp.signon $ctime } 


and
Code:
on 1:DISCONNECT:{ { echo -s disconnected from $server | iecho -s signon time  :    $asctime(%tmp.signon,ddd mmm d HH:nn:ss yyyy) | iecho -s signoff time :    $asctime($ctime,ddd mmm d HH:nn:ss yyyy) | iecho -s total ontime :    $replace($dur($calc($ctime - %tmp.signon)),wks,w,wk,w,days,d,day,d,hrs,h,hr,h,mins,m,min,m,secs,s,sec,s) | unset %tmp* } | haltdef } 


it's supposed to look like

disconnected from irc.blah.com
signon time : Tue Jul 20 17:19:57 2004
signoff time : Tue Jul 20 17:19:58 2004
total ontime : 1s

but if i connect to other servers after and disconnect from another or, both or however many i'm on at the time, all the stats are wrong ie;

disconnected from irc.blah2.net
signon time :
signoff time : Tue Jul 20 17:19:42 2004
total ontime : 1802w 5d 16h 19m 42s

any help would be great.
Posted By: Coolkill Re: On connect and disconnect - 20/07/04 05:26 PM
I've not looked for any bugs/ect in the coding so i'll take it, that it works just wanting it to be multiserver, to do so, try changing variables to the following:

from: %tmp.signon

to: $+(%,tmp.signon.,$server)

as a result your variables will be called %tmpsignon.myserver.com

so for every server theres a different variable, you can then call the variable back using $eval($+(%,tmp.signon.,$server)) or something alike.
Posted By: Marantz Re: On connect and disconnect - 20/07/04 06:35 PM
Ok i understand all that and seems correct, but when i call it back , the whole var appears %tmp.signon.irc.blah.comTue Jul 20 19:34:02 2004
Posted By: Coolkill Re: On connect and disconnect - 20/07/04 09:07 PM
Sorry for the delayed reply, didnt see your reply;

On *:Connect:{
set $+(%,tmp.signon.,$server) $ctime
}


There is also no such thing as $dur and /iecho wont work when not connected, so you cant use that, see this:

on 1:DISCONNECT:{
var %t = $server
echo -s disconnected from %t
echo -s signon time : $asctime($eval($+(%,tmp.signon.,%t),2),ddd mmm d HH:nn:ss yyyy)
echo -s signoff time : $asctime($ctime,ddd mmm d HH:nn:ss yyyy)
echo -s total ontime : $replace($duration($calc($ctime - $eval($+(%,tmp.signon.,%t),2))),wks,w,wk,w,days,d,day,d,hrs,h,hr,h,mins,m,min,m,secs,s,sec,s)
}


Eamonn.
Posted By: Marantz Re: On connect and disconnect - 21/07/04 10:16 AM
all working now, thanks $dur and iecho are my own aliases btw :tongue:
Posted By: Iori Re: On connect and disconnect - 22/07/04 08:32 AM
You could shorten this
$replace($dur($calc($ctime - %tmp.signon)),wks,w,wk,w,days,d,day,d,hrs,h,hr,h,mins,m,min,m,secs,s,sec,s)
To this
$remove($dur($calc($ctime - %tmp.signon)),ks,k,ays,ay,rs,r,ins,in,ecs,ec)
© mIRC Discussion Forums