Timer that repeats - New Question
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Timer that repeats - New Question
Hi, I´m being working in a timer since a few days ago and I´m trying that my timer repeats.
For example, My timer counts 30 seconds and if I press a button that says 6 on it I want that my timer counts 30 seconds 6 times. How can I do that?
postscript: sorry if you can't understand me so well , I do not master English very well.
For example, My timer counts 30 seconds and if I press a button that says 6 on it I want that my timer counts 30 seconds 6 times. How can I do that?
postscript: sorry if you can't understand me so well , I do not master English very well.
Re: Timer that repeats - New Question
Hi.
Does this give you some sort of clue? Make a buttons and a field. In the button script:
In the card script:
I made the timeout "3" instead of "30" so you can see it complete without having to wait three minutes. But I hope you get the idea.
Now then, please write back and tell me why the timer handler is in the card script. And then tell me why this is a good idea, especially if you have several different buttons, each of which might have a different value to repeat.
Craig Newman
Does this give you some sort of clue? Make a buttons and a field. In the button script:
Code: Select all
on mouseUp
startTimer 6
end mouseUp
Code: Select all
on startTimer numberOfRepeats
repeat numberOfRepeats
repeat with y = 1 to 3
put y into fld 1
wait 1 second
end repeat
end repeat
end startTimerNow then, please write back and tell me why the timer handler is in the card script. And then tell me why this is a good idea, especially if you have several different buttons, each of which might have a different value to repeat.
Craig Newman
Re: Timer that repeats - New Question
Be aware that Craig's script is blocking. That is, no other user actions will be allowed until the script completes.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Timer that repeats - New Question
Jacque makes a point. So think about this in the button script:
This sort of construction releases the program to the user. You might also learn about the "wait with messages" command, another useful way to do this.
Craig
Code: Select all
on mouseUp
put 0 into fld 1
startTimer 6
end mouseUp
on startTimer numberOfRepeats
if numberOfRepeats = 0 then exit to top
if fld 1 = 30 then
put 0 into fld 1
subtract 1 from numberOfRepeats
end if
add 1 to fld 1
send "startTimer" && numberOfRepeats to me in 10 --60 ticks = 1 second, the '10" is just so this handler does not take all day
end startTimerCraig
Re: Timer that repeats - New Question
Hi, Craig & Jacque you helped me a lot, it works perfectly!
But just another question:
I put just 1 button to play the timer, and I want that when I press the button depends, that what number says in a label, be the times that the timer will repeat. How can I implement the code that you gave me?
Regards|

But just another question:
I put just 1 button to play the timer, and I want that when I press the button depends, that what number says in a label, be the times that the timer will repeat. How can I implement the code that you gave me?
Regards|
Re: Timer that repeats - New Question
Hmmm.
I do not want to get into trouble with my fellow wizards. Oh, the hell with them.
You will recall that in the handler above, there was an explicit "6" set as a parameter to the command call. That value can come from anywhere, you know. What would happen if you set a property of that button, as you say, perhaps, its "label", to something useful to your purpose? In other words, when you click on the button, try to think of a way to use that property to set the value you want. What would you have to do in the handler to pull a value from the button, and then use that value to proceed?
Everyone else, keep your distance.
Craig
I do not want to get into trouble with my fellow wizards. Oh, the hell with them.
You will recall that in the handler above, there was an explicit "6" set as a parameter to the command call. That value can come from anywhere, you know. What would happen if you set a property of that button, as you say, perhaps, its "label", to something useful to your purpose? In other words, when you click on the button, try to think of a way to use that property to set the value you want. What would you have to do in the handler to pull a value from the button, and then use that value to proceed?
Everyone else, keep your distance.
Craig
Re: Timer that repeats - New Question
I had to laugh.Everyone else, keep your distance.
Anyway, in this case I think your approach is valid.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Timer that repeats - New Question
hahahahaha Thanks Craig!!! You help me so much. 
