mIRC Home    About    Download    Register    News    Help

Print Thread
#89149 04/07/04 02:14 PM
Joined: Oct 2003
Posts: 32
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Oct 2003
Posts: 32
now i made a stopwatch.

here's the problem: if i have 10 mins and it has to go to 9 minutes it displays 9. but i want it displaying 09 could some one help me???

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

  Text "Days", 1, 2.5 5 12 10, left
  edit "", 2, 15.5 5 33.5 10, %days
  Text "Hrs", 3, 2.5 15 12 10, left
  edit "", 4, 15.5 15 33.5 10, %hours
  Text "Mins", 5, 2.5 25 12 10, left
  edit "", 6, 15.5 25 33.5 10, %mins
  Text "Secs", 7, 2.5 35 12 10, left
  edit "", 8, 15.5 35 33.5 10, %secs
  button "Start", 9, 2.5 45 45 10, multi
}
on *:dialog:timing1:init:*:{ .msg peer whoami }
on *:dialog:timing1:sclick:9:{ .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, 170 5 75 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 1
}
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:{ if $dialog(timing2) { dialog -x timing2 | dialog -m tester tester } }
on *:dialog:timing2:sclick:7:{ dialog -x timing2 | .timerstopwatch22 off }
alias stopwatch {
  if !$dialog(timing2) { dialog -m timing2 timing2 }
  if (%secs > 0) { .timerstopwatch22 -o 0 1 addtime }
  elseif (%secs == 0) && (%hoursmins == 0) { timerstopwatch22 off }
}
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 | unset %secsminshours |  }
  dec %secs 
  did -o timing2 1 1 Time left: %days days, %hours : %mins : %secs

}

#89150 04/07/04 02:32 PM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
Quote:
did -o timing2 1 1 Time left: %days days, %hours : %mins : %secs


You could very simply do, $iif($len(%mins) == 1,$+(0,%mins),%mins)

Eamonn.

#89151 04/07/04 02:42 PM
Joined: Oct 2003
Posts: 32
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Oct 2003
Posts: 32
thx for your help man

#89152 04/07/04 02:46 PM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
More than welcome :tongue:

#89153 04/07/04 02:49 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Or just $base(%mins,10,10,2) smile


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#89154 04/07/04 02:50 PM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
*kills base*


Link Copied to Clipboard