mIRC Home    About    Download    Register    News    Help

Print Thread
#89185 04/07/04 04:07 PM
Joined: Oct 2003
Posts: 32
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Oct 2003
Posts: 32
nevermind the old problem

the prob now is when i have 1 week and 1 day it dec. weeks and sets days to 6. but it has to dec. days to 0 and after 24 hours it should dec weeks and then set days to 6

PS: Here's the code:

Code:
alias f12 { dialog -m timing1 timing1 }
dialog timing1 {
  option dbu
  title Stopwatch Start
  size -1 -1 50 70

  text "W'ks", 1, 2.5 5 12 10, left
  edit "", 2, 15.5 5 33.5 10, %weeks
  Text "Days", 3, 2.5 15 12 10, left
  edit "", 4, 15.5 15 33.5 10, %days
  Text "Hrs", 5, 2.5 25 12 10, left
  edit "", 6, 15.5 25 33.5 10, %hours
  Text "Mins", 7, 2.5 35 12 10, left
  edit "", 8, 15.5 35 33.5 10, %mins
  Text "Secs", 9, 2.5 45 12 10, left
  edit "", 10, 15.5 45 33.5 10, %secs
  button "Start", 11, 2.5 55 45 10, multi
}
on *:dialog:timing1:init:*:{ .msg peer whoami }
on *:dialog:timing1:sclick:11:{ .dialog -x timing1 | stopwatch }

dialog timing2 {
  option dbu
  title Stopwatch
  size -1 -1 300 0
  text "Stopwatch v 1.1 by junior.", 820, 2.5 5 75 10, left
  text "© Copyrights reserved", 821, 430 5 70 10, right
  text "Time left: ? days, ? : ? : ?", 1, 130 5 110 10, left

  button Stop, 5, 245.25 3 45.25 10
  button Restart, 6, 290.5 3 45.25 10
  button Close, 7, 335.75 3 45.25 10
}
on *:dialog:timing2:init:*:{
  dll dlls\mdx.dll SetMircVersion $version
  dll dlls\mdx.dll MarkDialog $dname
  dll dlls\mdx.dll SetDialog $dname style windowedge title
  dll dlls\mdx.dll Remove
  //dll dlls\kTools.dll DockWindow $dialog(timing2).hwnd > top 2
}
on *:dialog:timing2:sclick:5:{ .timerstopwatch22 off | .did -o timing2 1 1 Stopwatch | .did -o timing2 2 2 has | .did -o timing2 3 3 been | did -o timing2 4 4 turned off! | did -o timing2 820 820 The }
on *:dialog:timing2:sclick:6:{ dialog -m timing1 timing1 | .timerstopwatch22 off }
on *:dialog:timing2:sclick:7:{ dialog -x timing2 | .timerstopwatch22 off }
alias stopwatch {
  if !$dialog(timing2) { dialog -m timing2 timing2 }
  if (%secs > 0) { .timerstopwatch22 -om 0 1 addtime }
}
alias addtime { 
  if (%secs == 0) && (%mins > 0) { dec %mins | set %secs 60 }
  if (%secs == 0) && (%mins == 0) { set %secsmins 0 } 
  if (%secsmins == 0) && (%hours > 0) { dec %hours | set %mins 59 | set %secs 59 | unset %secsmins } 
  if (%secsmins == 0) && (%hours == 0) { set %secsminshours 0 | unset %secsmins }
  if (%secsminshours == 0) && (%days > 0) { dec %days | set %hours 23 | set %mins 59 | set %secs 59 }
  if (%secsminshours == 0) && (%days == 0) { Set %alltimings 0 }
  if (%alltimings == 0) && (%weeks > 0) { dec %weeks | set %days 6 | set %hours 23 | set %mins 59 | set %secs 59 | unset %alltimings }
  dec %secs 
  did -o timing2 1 1 Time left: $iif($len(%weeks) == 1,$+(0,%weeks),%weeks) weeks, $iif($len(%days) == 1,$+(0,%days),%days) days, $iif($len(%hours) == 1,$+(0,%hours),%hours) : $iif($len(%mins) == 1,$+(0,%mins),%mins) : $iif($len(%secs) == 1,$+(0,%secs),%secs)
  unset %alltimings
  unset %secsminshours
}

Last edited by misterman; 04/07/04 06:01 PM.
#89186 05/07/04 01:31 PM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
first off calc how much it all would be in seconds save it to a %var with the help of $calc

then run a timer to decrease the var per second and use $duration(%yourvar,2) to return how much time there is left in x weeks x days x hours x minutes x seconds.

only fall back in this is that youd have to be online all the time for it to be accurate :tongue:


$maybe

Link Copied to Clipboard