mIRC Home    About    Download    Register    News    Help

Print Thread
#110881 11/02/05 02:01 PM
Joined: Jan 2005
Posts: 75
Z
ztnaraM Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
Well, i have this timer in a small away system, which is set like this

.timeraway -cm 0 2700000 _away

to echo every 45 minutes, but this is what happens..

i'm still dead!! (sleep.) [45/m 1/s]
i'm still dead!! (sleep.) [1/h 30/m 1/s]
i'm still dead!! (sleep.) [2/h 15/m 1/s]
i'm still dead!! (sleep.) [3/h 2/s]
i'm still dead!! (sleep.) [3/h 45/m 1/s]
i'm still dead!! (sleep.) [4/h 30/m 1/s]
i'm still dead!! (sleep.) [5/h 14/m 37/s]

why does it fluctuate so much?
i don't see why it shoudn't just go..

i'm still dead!! (sleep.) [45/m]
i'm still dead!! (sleep.) [1/h 30/m]
i'm still dead!! (sleep.) [2/h 15/m]
i'm still dead!! (sleep.) [3/h]

and so on..
any views to this?

#110882 11/02/05 02:18 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Differing loads for mIRC and/or your OS at the time mostly I guess. Hi-res timers are more accurate (to the speed of the system clock) but use a lot more resources than normal timers.

#110883 11/02/05 02:23 PM
Joined: Jan 2005
Posts: 75
Z
ztnaraM Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
Would there be a way to round it up to the nearest minute when this happens?

#110884 11/02/05 02:36 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Easiest way would be to use $duration( ,2) which loses the seconds. :[/b])
*rounds down lol

#110885 11/02/05 03:23 PM
Joined: Feb 2005
Posts: 681
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
I needed to do something similar a while back, rounding
to the nearest minute I mean, this is what I made to do it
and return the seconds rounded to nearest minute, if
someone has a better way, please share smile

~ Edit ~
Removed my lame code, ty Iori you script god (goddess?) smile

To return formatted if N (N is optional)
$dur(seconds,N)
Code:
alias dur {
  if ($calc($1 % 60) < 30) var %a = - $+ $v1
  else var %a = 60 - $v1
  var %r = $calc($1 + %a)
  return $iif($2 isnum 1-3,$duration(%r,$2),%r)
}

Last edited by mIRCManiac; 11/02/05 04:01 PM.
#110886 11/02/05 03:42 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
How about
Code:
alias dur {
  if $calc($1 % 60) < 30 { var %a = - $+ $v1 }
  else var %a = 60 - $v1
  return $duration($calc($1 + %a))
}

#110887 11/02/05 05:05 PM
Joined: Jan 2005
Posts: 75
Z
ztnaraM Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
This is great, but if i'm away say for example a week or more
will it still only effect the minutes?

will it still show like that?
away i'm still dead!! (test) [1/w 3/d 18/h 45/m]

to be more secific, does it only effect the minutes? none of the hours/days/weeks etc.

Last edited by ztnaraM; 11/02/05 05:15 PM.
#110888 11/02/05 05:25 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
It will work for as long an amount of time as $duration() &/or $calc() works for. smile
As it is it won't show like "[1/w 3/d 18/h 45/m]" because thats not a return from $duration(). The output would be like "204wks 21hrs 33mins"
You could replace the output of it though.
  • $+([,$replace($remove($dur(<seconds>),s),wk,/w,hr,/h,day,/d,min,/m),])
    [207/w 3/d 1/h 6/m]

#110889 11/02/05 05:28 PM
Joined: Jan 2005
Posts: 75
Z
ztnaraM Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
Using your alias i did it like this

Code:
alias dur {
  if $calc($1 % 60) &lt; 30 { var %a = - $+ $v1 }
  else var %a = 60 - $v1
  return $chr(91) $+ $replace($remove($duration($calc($1 + %a)),ecs,ins,rs,ays,ks,ec,in,r,ay,k),w,/w,d,/d,h,/h,m,/m,s,/s)) $+ $chr(93)
} 

#110890 11/02/05 09:29 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Hmm OK grin

return $+([,$replace($remove($duration($calc($1 + %a)),s),wk,/w,hr,/h,day,/d,min,/m),])
return $chr(91) $+ $replace($remove($duration($calc($1 + %a)),ecs,ins,rs,ays,ks,ec,in,r,ay,k),w,/w,d,/d,h,/h,m,/m,s,/s)) $+ $chr(93)

I know which I would choose.. smile

#110891 12/02/05 12:58 AM
Joined: Jan 2005
Posts: 75
Z
ztnaraM Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
lol ok.. thanks for your help Iori, i do agree like alot of other posters on this board, you're a mIRC genius, i was great years back with lower versions of mIRC, but was away quite a few years, you know your stuff.
You're in inspiration to alot of people, keep up the good work. laugh

#110892 12/02/05 01:04 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
LOL Nah qwerty would be the genius laugh I'm just glad to help where I can smile

Edit: er I should also add there are a lot of others who hang out around these boards who also know their stuff.. grin

Last edited by Iori; 12/02/05 01:06 AM.
#110893 12/02/05 01:43 AM
Joined: Jan 2005
Posts: 75
Z
ztnaraM Offline OP
Babel fish
OP Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
yeah definitely, QWERTY does own too, but (big but) you can tell when certain people get attached to the people that help them out, your nick appeared in the search results about 500 times :tongue:


Link Copied to Clipboard