wait command

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
kevin11
Posts: 101
Joined: Thu Aug 11, 2011 5:02 pm

wait command

Post by kevin11 » Thu Feb 09, 2012 1:55 am

I can use a wait command, eg, wait until x < 10, but how do I trap the situation of x never becoming less than 10 ?

How do I execute :

wait until x < 10 but don't wait too long as other things need doing

flintGA2c5a
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 61
Joined: Tue Jan 24, 2012 10:35 am

Re: wait command

Post by flintGA2c5a » Thu Feb 09, 2012 8:48 am

I don't really understand what you are after here, maybe you can give an example of what you are trying to use it for?

kevin11
Posts: 101
Joined: Thu Aug 11, 2011 5:02 pm

Re: wait command

Post by kevin11 » Thu Feb 09, 2012 11:09 am

Well, it seems to me that a statement like wait until x < 10 is a good way to hang a program, if for some unforeseen reason x never gets below 10. So a way of programmatically bailing out of the wait in case of a bug.

Having spent most of yesterday with hangs, crashes, and my cards getting randomly renamed, and having to reboot just to get stuff working, and then when the stack opens it goes and hits the bug again, I am wary of a wait command waiting for hell to freeze over !

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: wait command

Post by Klaus » Thu Feb 09, 2012 12:31 pm

Hi guys,

"wait until ..." is always critical, unles you implement a back door,
so you can get out of this loop-of-death if this condition never happens!

I would use something with "send"! :D
But need more info to give a specific advice here...


Best

Klaus

kevin11
Posts: 101
Joined: Thu Aug 11, 2011 5:02 pm

Re: wait command

Post by kevin11 » Thu Feb 09, 2012 12:44 pm

Klaus wrote:"wait until ..." is always critical, unles you implement a back door,
so you can get out of this loop-of-death if this condition never happens!
Quite ! When I read the dictionary I thought you gotta be kidding ! That's such a poison pill when developing an app, there's bound to be something that stops the condition from happening.

Ideally the wait command would have two parameters, the first is the condition to check for, the second is a cap on time to wait. In an ideal world, only the first parameter is needed, but when developing code, the second is critical.

flintGA2c5a
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 61
Joined: Tue Jan 24, 2012 10:35 am

Re: wait command

Post by flintGA2c5a » Thu Feb 09, 2012 2:01 pm

I have to agree 100%. My first instinct was to do a or operation, but doesn't seem to allow to do this if you use both wait while and wait for. I came up with the following code, but for some reason this does not work even though I think it should:

Code: Select all

   put 11 into x
   put 5 into alarmTime
   wait while the seconds < alarmTime or x>10
   answer "broken"

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9660
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: wait command

Post by dunbarx » Thu Feb 09, 2012 3:21 pm

I suspect there is a simple and robust way to do what you want.

Can you post a simple concept script?

Craig Newman

kevin11
Posts: 101
Joined: Thu Aug 11, 2011 5:02 pm

Re: wait command

Post by kevin11 » Thu Feb 09, 2012 3:24 pm

dunbarx wrote:I suspect there is a simple and robust way to do what you want.
So do I !

I've posted a little stack under another topic.

Thanks

Kevin

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: wait command

Post by mwieder » Thu Feb 09, 2012 6:19 pm

Why are you posting the same thing in three different threads? This is getting annoying.

kevin11
Posts: 101
Joined: Thu Aug 11, 2011 5:02 pm

Re: wait command

Post by kevin11 » Thu Feb 09, 2012 6:37 pm

mwieder wrote:Why are you posting the same thing in three different threads? This is getting annoying.
One thread was about the wait statement, one about detecting end of movements. Different things.

Wasn't sure where to post the stack, so I put it in a third thread.

Quite simple, really, and I apologise for having challenged your intellect.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”