hi,
i would like a code that count backwords one minute (60 seconds).
best regards'
Itay
			
			
									
									
						timer
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: timer
Code: Select all
put the seconds into theCounter
put theCounter into theTime
repeat until theCounter - theTime >= 60
   put 60 - (theCounter - theTime) into field 1
   put the seconds into theCounter
   wait for 0.3 seconds with messages
end repeatVarious teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
						http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Re: timer
Itay:
Bernd's comment about sending in time is important, because it allows the computer to do other things while the counter is running. A repeat loop takes over everything unless you explicitly look out for other processes. In a button script on a card with a field:
Note that this script runs much more often than once per second; it usually just reloads the same time value. It still leaves plenty of room for other things to happen, as you will see when you run it. 
Craig
			
			
									
									
						Bernd's comment about sending in time is important, because it allows the computer to do other things while the counter is running. A repeat loop takes over everything unless you explicitly look out for other processes. In a button script on a card with a field:
Code: Select all
on mouseUp
   put the seconds into sTime
   put sTime + 60 into eTime
  countdown sTime,eTime
end mouseUp
on countDown sTime,eTime
   if the seconds > eTime then exit to top
   put 60 - (the seconds - sTime) into fld 1
   send "countDown sTime,eTime" to me in 1
end countDownCraig
