"on timer" message

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderator: Klaus

Post Reply
Garrett
Posts: 386
Joined: Sat Apr 08, 2006 8:15 am
Contact:

"on timer" message

Post by Garrett » Tue May 06, 2008 7:56 am

I'd like to see a built in timer feature for at least stack.

Code: Select all

on timer
  --do something here if needed
end timer
Allow this feature to be activated via "Basic Properties" as a checkbox along with the other properties for a stack with a spin or edit box to set the amount of time the timer will use before returning to the timer message (in sec or milisec).

Or... something to that effect.

A timer message... yeah, that'd work. ;-)

~Garrett

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Tue May 06, 2008 10:45 am

I don't really see any advantage for this, considering the script below works fine already. Maybe you can elaborate about what would be the difference to this existing approach?

Code: Select all

on mouseUp
  send "timerInterval" to me in 1 second
end mouseUp

on timerInterval
  --do stuff here 
  send "timerInterval" to me in 1 second
end timerInterval
of course rev is very linear and sequential, so barring a completely new engine, this will never be exactly one second, but always a bit more.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Garrett
Posts: 386
Joined: Sat Apr 08, 2006 8:15 am
Contact:

Post by Garrett » Tue May 06, 2008 9:17 pm

BvG wrote:I don't really see any advantage for this, considering the script below works fine already. Maybe you can elaborate about what would be the difference to this existing approach?
Of course you don't see any advantage, because you've been using Rev since the days of Methuselah! :P Ok, Ok, so we're both as old as Methuselah, but you've been using Rev far longer than me! :roll: The thing is, old dogs using Rev know all the neat little tricks and work arounds, but the new users of Rev have no clue of such things. Touting this as an actual feature and being documented as such would allow users to find this ability quickly instead of trying to find some vague references to "send vagueHomeBrewTimerEvent to me in 5 seconds"

Time is an event. Rev is "Event Driven", so why not include the timer as an event as it should be?

The timer should've been something included in Rev already, it seems to me to that it would fit right in correctly as an event message as I suggested. Regardless of the work around noted, most users are not going to realize that or even find that workaround. A timer event message would be so much easier for all users to find and use, and it would save a lot of users time. Who would think to look up "send" when they need a "timer"? Or would they likely seek "timer" in the docs? Type the word timer in the rev docs search, you get "lowResolutionTimers", which offers no assistance in setting up and or using a timer in Rev. Nothing about how to use "send" as a timer at all. So the user is left with nothing at all. Now they have the choice of scrapping their project, using another language that does have a timer event, seeking help on the mailing list or forums, provided they even have net access where they are working on their project. In any scenario, they've just lost time (no pun intended).

And instead of using "send" and then having to use different code, or more code to turn off your home brew timer, you could simply turn it off and on in a fashion such as this:

set the timer of me to false

or to turn it back on:

set the timer of me to true

and to set, or reset the required interval, something like this:

set the timerInterval of me to 3 seconds

It just seems logical to me, it just seems to fit the Rev flow properly, as if it was a missing piece that should finally be put in.

Anyway, just a suggestion.

~Garrett

Post Reply