mIRC Home    About    Download    Register    News    Help

Print Thread
#128388 24/08/05 12:23 PM
Joined: Mar 2004
Posts: 6
W
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
W
Joined: Mar 2004
Posts: 6
Code:
raw 317:*:{ 
  set %idlesecs $asctime($3, s)
  set %idlemins $asctime($3, n)
  set %idlehors  $gettok($calc($3 / 60 / 60 ),1, 46) 
  if ($len(%idlehors) == 3) { set %idlehors $gettok($calc(%idlehors / 60), 1,46) }
  set %idledays $gettok($calc($3 / 60 / 60 / 24),1, 46) 
  set %connecttotal $calc( $gmt - $4 )
  set %connectdays $gettok($calc( %connecttotal / 60 / 60 / 24 ), 1, 46)
  set %connecthors $gettok($calc( %connecttotal / 60 / 60 ), 1, 46)
  if ($len(%connecthors) == 3) { set %connecthors $gettok($calc(%connecthors / 60), 1,46) }
  set %connectmins $asctime(%connecttotal, n)
  set %connectsecs $asctime(%connecttotal, s)
  if ((%idlesecs >= 0) && (%idlemins == 0) && (%idlehors == 0) && (%idledays == 0)) { echo $active  $+ $color(whois text) $+ $timestamp $2 has been idle %idlesecs $+ secs, Signed On $asctime($4,ddd mmm dd HH:nn:ss) }
  if ((%idlesecs >= 0) && (%idlemins >= 1) && (%idlehors == 0) && (%idledays == 0)) { echo $active  $+ $color(whois text) $+ $timestamp $2 has been idle %idlemins $+ mins %idlesecs $+ secs, Signed On $asctime($4,ddd mmm dd HH:nn:ss) }
  if ((%idlesecs >= 0) && ((%idlemins >= 1) || (%idlemins == 0)) && (%idlehors >= 1) && (%idledays == 0)) { echo $active  $+ $color(whois text) $+ $timestamp $2 has been idle %idlehors $+ hours %idlemins $+ mins %idlesecs $+ secs, Signed On $asctime($4,ddd mmm dd HH:nn:ss) }
  if ((%idlesecs >= 0) && ((%idlemins >= 1) || (%idlemins == 0)) && ((%idlehors >= 1) || (%idlehors == 0)) && (%idledays >= 1)) { echo $active  $+ $color(whois text) $+ $timestamp $2 has been idle %idledays $+ days %idlehors $+ hours %idlemins $+ mins %idlesecs $+ secs, Signed On $asctime($4,ddd mmm dd HH:nn:ss) } 
  if ((%connectsecs >= 0) && (%connectmins == 0) && (%connecthors == 0) && (%connectdays == 0)) { echo $active  $+ $color(whois text) $+ $timestamp $2 has been connected for %connectsecs $+ secs }
  if ((%connectsecs >= 0) && (%connectmins >= 1) && (%connecthors == 0) && (%connectdays == 0)) { echo $active  $+ $color(whois text) $+ $timestamp $2 has been connected for %connectmins $+ mins %connectsecs $+ secs }
  if ((%connectsecs >= 0) && ((%connectmins >= 1) || (%connectmins == 0)) && (%connecthors >= 1) && (%connectdays == 0)) { echo $active  $+ $color(whois text) $+ $timestamp $2 has been connected for %connecthors $+ hours %connectmins $+ mins %connectsecs $+ secs }
  if ((%connectsecs >= 0) && ((%connectmins >= 1) || (%connectmins == 0)) && ((%connecthors >= 1) || (%connecthors == 0)) && (%connectdays >= 1)) { echo $active  $+ $color(whois text) $+ $timestamp $2 has been connected for %connectdays $+ days %connecthors $+ hours %connectmins $+ mins %connectsecs $+ secs }
}


[13:21] rhesus has been idle 8hours 52mins 30secs, Signed On Sun Aug 21 23:58:43
[13:21] rhesus has been connected for 2days 61hours 23mins 5secs

the code above is returning " wild " times, like 61hours, how can this be stopped?
thanks smile

#128389 24/08/05 01:10 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
if ($len(%idlehors) == 3) { set %idlehors $gettok($calc(%idlehors / 60), 1,46) }

and

if ($len(%connecthors) == 3) { set %connecthors $gettok($calc(%connecthors / 60), 1,46) }

These lines don't make sense... if the number of hours has a length greater than 3, divide it by 60 again?

A couple things to help you:

1) Don't use $gettok($calc(%connecthors / 60),1,46) ... Use $int($calc(%connecthors / 60)) for all areas that you're using $gettok to get the whole number instead.

2) Use $duration($asctime($3)) instead of your script to get the output you're looking for. And also $duration($calc($gmt - $4))


Invision Support
#Invision on irc.irchighway.net
#128390 24/08/05 01:27 PM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
All that code for just the time online, idle and the sign on time ?
Do you have a reason for the big coding?
Can you explain?

#128391 24/08/05 02:05 PM
Joined: Mar 2004
Posts: 6
W
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
W
Joined: Mar 2004
Posts: 6
thanks for the help, i removed the $asctime from the $duration to forfill my needs the rest was perfect wink

well i normally make, protections etc, so when it comes down to using $asctime $duration etc, im pretty newbie :P

i couldnt think of a better way to do it smile and evenutally, i discovered, the codes i had worked but, it was buggy, sometimes i would get 1837hours, and it fix it, it had to be divided by 600, dunno why but it worked fine if i done that, ah well, thanks all smile


Link Copied to Clipboard