Alan.Kay at squeakland.org
Wed Feb 19 08:48:12 PST 2003
Hi Phil --
At 11:00 AM -0500 2/19/03, Phil Firsenbaum wrote:
>Thanks much for the help with repeating a script...I think I've got
>the idea now. Any script can be repeated by using a conditional
>(test) statement (if that's the right nomenclature).
Not exactly. Any script can be repeated (period). You can get it to
repeat by clicking on the clock (on the script, in the viewer, or on
the go, step, stop button found in "Widgets"), or by holding down
where it says "normal" and choosing "ticking", or by sending it a
message - to start up script "car foo":
car start script foo
These tiles are found under the category "scripting".
Looking at your picture, I see that the scripts "startRepeat" and
"setup1" are both paused, which means they must once have been
ticking. But neither of these scripts should be looped. They are both
designed to be run once, they should be set to "normal".
>So, here's my project thus far. Activating the first script moves
>the object (Roam1) based on the value of the slider (light blue
>rectangle). Now, I'd like to be able to show that value without
>using the object's Viewer.
Go into the viewer and look at the menu associated with the slider's
"numericValue" property. The menu includes choices for a "simple
watcher" and a "fancy watcher". The first just gives you a number
that will reflect the the value of the property, the second will give
you a UI for this value that includes a label and the ability to set
the value from the UI (this is the option that is usually most useful
> My initial goal with this project (in addition to learning how to
>create it for myself) is to have 1st and 2nd graders work with
>estimating distance and number values...they will set the value of
>the slider as they attempt to get the object to land in the box at
>the top of the track.
forward 30 is too long a distance -- it will be about 1/3" on some screens.
>I've also been trying to slow down the movement of the object so
>that kids can see more clearly what is happening. Haven't figured
>that one out yet either.
Press down on the clock in a script and hold it until a menu appears.
This will allow you to set how many ticks per second the script will
execute. (This can also be programmed by hand using a variable to
hold a delay count.)
Another way to slow it down and get some precision would be to just
do "Roam1 forward 1".
I think there might be a somewhat richer approach to this project,
that allows the children to do some scripting rather than just use
what the teacher has provided. Let me know if you are interested in
>On Monday, February 17, 2003, at 10:38 PM, Alan Kay wrote:
>>Well, each script can repeat over and over -- so this is quite
>>doable. However, there is not a case tile (like Test) for
>>parameterized Repeats (though we could certainly make one).
>>However, I think that part of the wide spread success of the
>>current system is how few features it has -- it relies mostly on
>>having a good object system plus a few programming features.
>>Here's how to do it. Suppose you know how many steps of 30 that
>>need to be traversed and you have that number in a variable called
>>Then you just have to build the three cases of the loop -- startup,
>>looping, and ending.
>>This can be done in one script, but it is clearer and cleaner to
>>use two scripts.
>>There are many ways to write these scripts. This one makes it quite
>>clear how many iterations have been done.
>>Now, having shown how to do this, it is rarely the case that a
>>student will need to write a script like this, especially for
>>robots. You are much better off having them write a script that
>>finds the destination rather than measures it. This is simpler,
>>clearer, and more general. You can see some of these ideas in the
>>feedback projects on squeakland.org (particularly those that get
>>cars to follow roads). Here is a simple example of what I mean:
>>This script will work regardless of the distance between the two blobs.
>>At 8:46 PM -0500 2/17/03, Phil Firsenbaum wrote:
>>I'm working on a little project (i'll use it with younger students
>>if I get it to work). It involves getting an object move a certain
>>number of "steps" (each being a forward 30) in order to go from one
>>point to another. It's actually a simulation of work being done
>>with Roamer floor robots.
>>Anyhow I want the students to be able to figure out how many
>>"steps" the object needs to take...I thought if I could script a
>>repeat tile I could accomplish this part of the project pretty
>>nicely. I haven't seen anything about repeats, though, in the etoy
>>environment. Does it exist? If not, any thoughts anyone?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeakland