Wait until the move is done(?)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 223
- Joined: Wed Jun 21, 2006 7:33 pm
- Contact:
Wait until the move is done(?)
I've got a handler that does this:
move graphic "ball" to 300,300 in one second
--then we do other things
The problem is that the "other things" start before the move is complete. I tried adding "wait 1 second" after the first line of code but that seems to freeze everything so you don't see the object move properly and the other things (that do some more movement) don't work properly because the position of the object isn't where it should be. So I'm looking for the equivalent to "wait until the move is done", as in:
move graphic "ball" to 300,300 in one second
wait until the move is done
--then we do other things
Any suggestions welcomed!
Thanks,
Barry
move graphic "ball" to 300,300 in one second
--then we do other things
The problem is that the "other things" start before the move is complete. I tried adding "wait 1 second" after the first line of code but that seems to freeze everything so you don't see the object move properly and the other things (that do some more movement) don't work properly because the position of the object isn't where it should be. So I'm looking for the equivalent to "wait until the move is done", as in:
move graphic "ball" to 300,300 in one second
wait until the move is done
--then we do other things
Any suggestions welcomed!
Thanks,
Barry
Re: Wait until the move is done(?)
HI Barry,
you do not need to do anything!
...
move graphic "ball" to 300,300 in one second
put "Done"
...
"Done" will appear in the message box AFTER the graphic has stopped.
Just tested, that is "normal" behavior
If you want to continue the script immediately after the object starts moving, add this:
...
move graphic "ball" to 300,300 in 1 secs WITHOUT WAITING
put "Done"
...
"Done" will appear immediately in the message box.
Best
Klaus
you do not need to do anything!
...
move graphic "ball" to 300,300 in one second
put "Done"
...
"Done" will appear in the message box AFTER the graphic has stopped.
Just tested, that is "normal" behavior

If you want to continue the script immediately after the object starts moving, add this:
...
move graphic "ball" to 300,300 in 1 secs WITHOUT WAITING
put "Done"
...
"Done" will appear immediately in the message box.
Best
Klaus
-
- Posts: 223
- Joined: Wed Jun 21, 2006 7:33 pm
- Contact:
Re: Wait until the move is done(?)
Klaus,
Thanks. However, what I need to do is wait until the object has finished moving before the script continues.
Barry
edit: If I leave off the "without waiting", that should do it?
Thanks. However, what I need to do is wait until the object has finished moving before the script continues.
Barry
edit: If I leave off the "without waiting", that should do it?
Last edited by rumplestiltskin on Wed Nov 20, 2013 6:26 pm, edited 1 time in total.
Re: Wait until the move is done(?)
I created a start button and two extra buttons and then put this code into the start button:
on mouseup
move button "b1" from 200,250 to 250,300 in 2 seconds
wait 2 seconds
move button "b2" from 200,250 to 350,400 in 2 seconds
end mouseup
I do not know if this helps if you compare it with anything you have done, but it worked as expected. Hope I have not misunderstood you.
kind regards
chris
on mouseup
move button "b1" from 200,250 to 250,300 in 2 seconds
wait 2 seconds
move button "b2" from 200,250 to 350,400 in 2 seconds
end mouseup
I do not know if this helps if you compare it with anything you have done, but it worked as expected. Hope I have not misunderstood you.
kind regards
chris
-
- Posts: 223
- Joined: Wed Jun 21, 2006 7:33 pm
- Contact:
Re: Wait until the move is done(?)
Yes, all I needed to do was leave off the "without messages" and that resolved it.
move graphic 1 to 300,300 in 1 second
wait .2 seconds -- just so the user sees the object has, indeed, been moved back to the starting point before moving it again.
rest of stuff gets done
Thanks Klaus and Chris! As is usual, all I needed to do was have a few sets of new eyes to help clarify this.
I-am-not-worthy...
Barry
move graphic 1 to 300,300 in 1 second
wait .2 seconds -- just so the user sees the object has, indeed, been moved back to the starting point before moving it again.
rest of stuff gets done
Thanks Klaus and Chris! As is usual, all I needed to do was have a few sets of new eyes to help clarify this.
I-am-not-worthy...
Barry
Re: Wait until the move is done(?)
neither am I....but getting others to disagree with you helps....