[Q] How to delay an execution of a command tile in a script

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Q] How to delay an execution of a command tile in a script

Young-Jin Lee-3
Hello,

I am looking for a way to delay a certain action for a certain period of time. For instance, I have a book and want to flip the page when the mouse cursor is touch another Sketch. But, I want to delay the page flipping for a certain period of time instead of doing it right away because I want, for instance, to show a Text widget after the mouse cursor touched another Sketch, but before flipping the book page. Without delaying the flipping of a book page, I cannot even read the text in the Text Widget. 

Related to this, I am wondering if I can play a short sound clip repeated in a script that is being executed repeatedly. I want to play a certain sound repeated while a sketch is roaming around the World. If I put the "play sound" tile in the script that will make the Sketch roam the World, I got echoes because the "play sound" is invoked before the previous execution of the previous call to "play sound" ends as I invoke this roaming script repeatedly (by clicking on its clock icon on the scriptor). 

Is there a way to resolve these problems?

Thanks in advance.

Young-Jin Lee

_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: [Q] How to delay an execution of a command tile in a script

Ricardo Moran
I've made this simple project with a "delay object". You can duplicate it and change the execute action script to perform anything you want. Then you simply run the "startDelay:" script with the duration as a parameter.
I hope you find it useful. I don't know if there is an easier way, though.

Cheers


On Tue, Nov 17, 2009 at 8:19 PM, Young-Jin Lee <[hidden email]> wrote:
Hello,

I am looking for a way to delay a certain action for a certain period of time. For instance, I have a book and want to flip the page when the mouse cursor is touch another Sketch. But, I want to delay the page flipping for a certain period of time instead of doing it right away because I want, for instance, to show a Text widget after the mouse cursor touched another Sketch, but before flipping the book page. Without delaying the flipping of a book page, I cannot even read the text in the Text Widget. 

Related to this, I am wondering if I can play a short sound clip repeated in a script that is being executed repeatedly. I want to play a certain sound repeated while a sketch is roaming around the World. If I put the "play sound" tile in the script that will make the Sketch roam the World, I got echoes because the "play sound" is invoked before the previous execution of the previous call to "play sound" ends as I invoke this roaming script repeatedly (by clicking on its clock icon on the scriptor). 

Is there a way to resolve these problems?

Thanks in advance.

Young-Jin Lee

_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland



_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland

Delay example.001.pr (184K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Q] How to delay an execution of a command tile in a script

p.a.dreyfuss@excite.com
In reply to this post by Young-Jin Lee-3

Hi,
Very nice this project, all done in a morph that could be given to kids as a tool.
it should be published on showcase.
I have replaced the first demo by a solution for repeating sounds, it is not pure Etoys, it uses a script written in smalltalk for getting the length of the sound which is put in a variable.

The rest uses what is done for delay. The timing is changed to ten ticks by second and the length is in tenth of second.

The script delay, is called at the end of the script executeAction,initiating new cycle of delay and making executeAction recursive.The sound will repeat infinitely, each time the delay expires. To stop it, just pause the delay script.
To start, just execute executeAction .

I'm working at a different way, adding a duration tile to sound category but this wants more thinking.


Sorry for the strange name of the project, it is due to Sugar, It was 'delayWithSound.' :-)

Regards



-----Original Message-----
From: "Ricardo Moran" [[hidden email]]
Date: 11/17/2009 08:49 PM
To: "Young-Jin Lee" <[hidden email]>
CC: [hidden email]
Subject: Re: [squeakland] [Q] How to delay an execution of a command tile in a
script

Ive made this simple project with a "delay object". You can duplicate it and change the execute action script to perform anything you want. Then you simply run the "startDelay:" script with the duration as a parameter.I hope you find it useful. I dont know if there is an easier way, though.


Cheers


On Tue, Nov 17, 2009 at 8:19 PM, Young-Jin Lee <[hidden email]> wrote:
Hello,

I am looking for a way to delay a certain action for a certain period of time. For instance, I have a book and want to flip the page when the mouse cursor is touch another Sketch. But, I want to delay the page flipping for a certain period of time instead of doing it right away because I want, for instance, to show a Text widget after the mouse cursor touched another Sketch, but before flipping the book page. Without delaying the flipping of a book page, I cannot even read the text in the Text Widget. 


Related to this, I am wondering if I can play a short sound clip repeated in a script that is being executed repeatedly. I want to play a certain sound repeated while a sketch is roaming around the World. If I put the "play sound" tile in the script that will make the Sketch roam the World, I got echoes because the "play sound" is invoked before the previous execution of the previous call to "play sound" ends as I invoke this roaming script repeatedly (by clicking on its clock icon on the scriptor). 


Is there a way to resolve these problems?


Thanks in advance.


Young-Jin Lee

_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland






   Earn a Degree in Dental Assisting. Find Schools and Apply today!
Dental Assistant Degree
AllAlliedHealthSchools.com
 

_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland

tmp8wPhsI.pr (209K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Q] How to delay an execution of a command tile in a script

Karl Ramberg
On 2009-11-18 16:01, [hidden email] wrote:

Hi,
Very nice this project, all done in a morph that could be given to kids as a tool.
it should be published on showcase.
I have replaced the first demo by a solution for repeating sounds, it is not pure Etoys, it uses a script written in smalltalk for getting the length of the sound which is put in a variable.

The rest uses what is done for delay. The timing is changed to ten ticks by second and the length is in tenth of second.

The script delay, is called at the end of the script executeAction,initiating new cycle of delay and making executeAction recursive.The sound will repeat infinitely, each time the delay expires. To stop it, just pause the delay script.
To start, just execute executeAction .

I'm working at a different way, adding a duration tile to sound category but this wants more thinking.


Sorry for the strange name of the project, it is due to Sugar, It was 'delayWithSound.' :-)

Regards


Have you looked at the SoundPlayer>>waitUntilDonePlaying: method.
Maybe that could be added to Player so repeated sounds would wait until the previous sample is done.

Karl



-----Original Message-----
From: "Ricardo Moran" [[hidden email]]
Date: 11/17/2009 08:49 PM
To: "Young-Jin Lee" [hidden email]
CC: [hidden email]
Subject: Re: [squeakland] [Q] How to delay an execution of a command tile in a
script

Ive made this simple project with a "delay object". You can duplicate it and change the execute action script to perform anything you want. Then you simply run the "startDelay:" script with the duration as a parameter.I hope you find it useful. I dont know if there is an easier way, though.


Cheers


On Tue, Nov 17, 2009 at 8:19 PM, Young-Jin Lee [hidden email] wrote:
Hello,

I am looking for a way to delay a certain action for a certain period of time. For instance, I have a book and want to flip the page when the mouse cursor is touch another Sketch. But, I want to delay the page flipping for a certain period of time instead of doing it right away because I want, for instance, to show a Text widget after the mouse cursor touched another Sketch, but before flipping the book page. Without delaying the flipping of a book page, I cannot even read the text in the Text Widget. 


Related to this, I am wondering if I can play a short sound clip repeated in a script that is being executed repeatedly. I want to play a certain sound repeated while a sketch is roaming around the World. If I put the "play sound" tile in the script that will make the Sketch roam the World, I got echoes because the "play sound" is invoked before the previous execution of the previous call to "play sound" ends as I invoke this roaming script repeatedly (by clicking on its clock icon on the scriptor). 


Is there a way to resolve these problems?


Thanks in advance.


Young-Jin Lee

_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland






   Earn a Degree in Dental Assisting. Find Schools and Apply today!
Dental Assistant Degree
AllAlliedHealthSchools.com
 
_______________________________________________ squeakland mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/squeakland


_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: [Q] How to delay an execution of a command tile in a script

K. K. Subramaniam
In reply to this post by Young-Jin Lee-3
On Wednesday 18 November 2009 04:49:28 am Young-Jin Lee wrote:
> I am looking for a way to delay a certain action for a certain period of
> time. For instance, I have a book and want to flip the page when the mouse
> cursor is touch another Sketch. But, I want to delay the page flipping for
>  a certain period of time instead of doing it right away because I want,
>  for instance, to show a Text widget after the mouse cursor touched another
>  Sketch, but before flipping the book page. Without delaying the flipping
>  of a book page, I cannot even read the text in the Text Widget.
Use a dummy hidden morph to track delay (say line). When the mouse touches
another sketch, display the text widget, set line's heading to 0 and get it to
rotate (say 5 degrees a second). When the line reaches a preset heading, hide
the text widget, flip the page and stop the script.

Subbu
_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: [Q] How to delay an execution of a command tile in a script

p.a.dreyfuss@excite.com
In reply to this post by Karl Ramberg
Hi Karl,
Thanks for the help,
The attached project is an empty project, just with a new tile in the sound category, playSoundUntilDone.
If there are many ticking scripts, each sound is played at turn.

Accept saving changes when saving you project if asked for.(depending choices for saving).

Start with this project and rename it before saving, if you are using the new tile.
Regards


-----Original Message-----
From: "Karl Ramberg" [[hidden email]]
Date: 11/18/2009 12:00 PM
To: "[hidden email]" <[hidden email]>
CC: [hidden email]
Subject: Re: [squeakland] [Q] How to delay an execution of a command tile
in a script

On 2009-11-18 16:01, [hidden email] wrote:
Hi,
Very nice this project, all done in a morph that could be given to kids as a tool.
it should be published on showcase.
I have replaced the first demo by a solution for repeating sounds, it is not pure Etoys, it uses a script written in smalltalk for getting the length of the sound which is put in a variable.

The rest uses what is done for delay. The timing is changed to ten ticks by second and the length is in tenth of second.

The script delay, is called at the end of the script executeAction,initiating new cycle of delay and making executeAction recursive.The sound will repeat infinitely, each time the delay expires. To stop it, just pause the delay script.
To start, just execute executeAction .

I'm working at a different way, adding a duration tile to sound category but this wants more thinking.


Sorry for the strange name of the project, it is due to Sugar, It was 'delayWithSound.' :-)

Regards


Have you looked at the SoundPlayer>>waitUntilDonePlaying: method.
Maybe that could be added to Player so repeated sounds would wait until the previous sample is done.

Karl



-----Original Message-----
From: "Ricardo Moran" [[hidden email]]
Date: 11/17/2009 08:49 PM
To: "Young-Jin Lee" <[hidden email]>
CC: [hidden email]
Subject: Re: [squeakland] [Q] How to delay an execution of a command tile in a
script

Ive made this simple project with a "delay object". You can duplicate it and change the execute action script to perform anything you want. Then you simply run the "startDelay:" script with the duration as a parameter.I hope you find it useful. I dont know if there is an easier way, though.


Cheers


On Tue, Nov 17, 2009 at 8:19 PM, Young-Jin Lee <[hidden email]> wrote:
Hello,

I am looking for a way to delay a certain action for a certain period of time. For instance, I have a book and want to flip the page when the mouse cursor is touch another Sketch. But, I want to delay the page flipping for a certain period of time instead of doing it right away because I want, for instance, to show a Text widget after the mouse cursor touched another Sketch, but before flipping the book page. Without delaying the flipping of a book page, I cannot even read the text in the Text Widget. 


Related to this, I am wondering if I can play a short sound clip repeated in a script that is being executed repeatedly. I want to play a certain sound repeated while a sketch is roaming around the World. If I put the "play sound" tile in the script that will make the Sketch roam the World, I got echoes because the "play sound" is invoked before the previous execution of the previous call to "play sound" ends as I invoke this roaming script repeatedly (by clicking on its clock icon on the scriptor). 


Is there a way to resolve these problems?


Thanks in advance.


Young-Jin Lee

_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland





   Earn a Degree in Dental Assisting. Find Schools and Apply today!
Dental Assistant Degree
AllAlliedHealthSchools.com

 
_______________________________________________ squeakland mailing list [hidden email]://lists.squeakland.org/mailman/listinfo/squeakland


   Earn your MBA from Regis University, 100% online. Free info packs!
Regis University MBA
Click Here For More Information
 

_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland

tmp_aswj4.pr (8K) Download Attachment