Page 2 of 2

Posted: Mon Oct 31, 2005 3:21 pm
by {Nathan}
You can get it to work as long as your loop runs in =< 1 second of time, otherwise it can skip a second every now and then.

Posted: Tue Nov 01, 2005 1:29 pm
by lostoros
OK, i have the loop now and it looks something like this

Code: Select all

t! = timer +1
timerem = timestart     

'timestart is 300 in this case 5 minutes, set in another spot

DO
 If timer = T! then
  t! = timer +1
  timerem = timerem -1
  minuterem = timerem/60
  secrem = int(timestart-(minuterem*60)
  print fix(minuterem);
  print ":";
  print 60- secrem
 end if
loop
but it has some issues...
1. When it gets to single digits in seconds remaining 4:09 for isntance. how do I get it to display "4:09" instead of "4: 9"? i've tried some simple work arounds that have failed..any ideas?

2. When it gets past 4 minutes even, the minutes change to 3, but the seonds go down past 0, instead of going back to 59. i get 3:-1, etc. how do i fix this, once again i've tried some simple stuff but its failed

other then that its been good though...

Posted: Tue Nov 01, 2005 2:04 pm
by Seb McClouth
In order to show "xx:xx" you'll need to add some stuff:

Code: Select all

if len(ltrim$(rtrim$(str$(secrem)))) < 2 then
  print "0"+ltrim$(rtrim$(str$(secrem)))
else
  print secrem
end if
I hope this works for ya!

grtz
Seb

Posted: Tue Nov 01, 2005 7:03 pm
by moneo
lostoros,

Your conversion of seconds to MM:SS is not working. I'm going to insert into your code part of the conversion logic which I previously posted.

Code: Select all

t! = timer +1
timerem = timestart     

'timestart is 300 in this case 5 minutes, set in another spot
'***NOTE: The following will only work if minutes is less than 60,
' that is, if timestart is less than 3600.

DO
 If timer = T! then
  t! = timer +1
  timerem = timerem -1
  rem ... minuterem = timerem/60
  rem ...secrem = int(timestart-(minuterem*60)
  ISEC=timerem
  IF ISEC >= 60 THEN 
      MM = INT(ISEC/60) 
      ISEC=ISEC-MM*60 
  ELSE 
     MM = 0 
  END IF 
  SS = ISEC 
  print right$("00"+ltrim$(str$(MM)),2);":";
  print right$("00"+ltrim$(str$(SS)),2)
 end if
loop
This should solve all your "issues".
*****