mIRC Home    About    Download    Register    News    Help

Print Thread
On connect and disconnect #91170 20/07/04 04:28 PM
Joined: Mar 2003
Posts: 160
Marantz Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2003
Posts: 160
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.

Re: On connect and disconnect #91171 20/07/04 05:26 PM
Joined: Dec 2002
Posts: 788
C
Coolkill Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
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.

Re: On connect and disconnect #91172 20/07/04 06:35 PM
Joined: Mar 2003
Posts: 160
Marantz Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2003
Posts: 160
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

Re: On connect and disconnect #91173 20/07/04 09:07 PM
Joined: Dec 2002
Posts: 788
C
Coolkill Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
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.

Re: On connect and disconnect #91174 21/07/04 10:16 AM
Joined: Mar 2003
Posts: 160
Marantz Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2003
Posts: 160
all working now, thanks $dur and iecho are my own aliases btw :tongue:

Re: On connect and disconnect #91175 22/07/04 08:32 AM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
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)