I can't assign a variable to the "add a parameter" feature available through the scripts menu in etoys. The parameter type is displayed and the type can be altered but it doesn't go green when I try to replace it with a variable of the right type. I can drag off a tile for the parameter type but that doesn't seem to help.
(it seems the same in the OLPC version too) Can anyone point me to an online project that utilises add a parameter? I'm trying to make a fractal tree in etoys but need two parameters. Is it possible? -- Bill Kerr http://billkerr2.blogspot.com/ _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
On Nov 1, 2007, at 3:50 PM, Bill Kerr wrote:
> I can't assign a variable to the "add a parameter" feature available > through the scripts menu in etoys. The parameter type is displayed > and the type can be altered but it doesn't go green when I try to > replace it with a variable of the right type. I can drag off a tile > for the parameter type but that doesn't seem to help. Hi, Bill, I'm not sure I understand exactly what you're asking, but perhaps a few general words about script parameters, and a simple example, will be helpful... The "Tile for the parameter type" that you can drag from the header of a Scriptor is actually a tile representing the parameter value itself. You can drop such a tile at any type-appropriate place within the body of the script. Thus, if the parameter type is "color", the tile will be labeled "Color", and can be dropped on any Color-type tile in the script, and if the parameter type is "number", the tile will be labeled "Number" and can be dropped on any Number-type tile in the script, etc. I attach a small example which illustrates use of a script parameter. The script that has a parameter is called "wobble", and it takes a numeric-valued parameter. Its role is to make the object turn by a random amount within the limit specified by the parameter. The larger the value of the parameter, the wider will be the variance. Notice that in the body of the script, there are two places where a "Number" tile, representing the value of the numeric parameter, is used. Both of these "Number" tiles were obtained by dragging them from the "number" tile in parameter area in the header, then dropping them on numeric-valued tiles: A typical use of such a script can be seen in the two other scripts in the example, one called "wideWobble", which calls "wobble" with a parameter value of 70 (degrees), which makes for fairly wild random wobble, and the other called "narrowWobble", which calls "wobble" with a parameter value of 20 degrees, which makes for much less erratic motion. Here's the script for "narrowWobble": You can experiment with the behavior of these two scripts by holding down the yellow "!" control for one or the other, or by first making one of them "ticking", then observing the effect, then stopping that script and making the other one tick, etc. Or, for a combined effect (fwiw) make them both tick at the same time, perhaps at different ticking rates. BTW: we have successfully prototyped a much better UI for presenting parameters to the user; the new design allows the user to *name* the parameter, allows a *default value* for the parameter to be specified in the scriptor's header, and (because of now having a default value) also allows a script with a paremeter to be set "ticking". But unfortunately we haven't had time yet to bring this into the mainstream etoys system. > I'm trying to make a fractal tree in etoys but need two parameters. > Is it possible? No, sorry, only one parameter is allowed per script in this version of etoys. The standard workaround for this is to pass the desired additional parameter info in a *variable* which you add to the object for just this purpose, and which you set in the caller, and which you "get" in script itself. This requires extra bookkeeping by the person writing the script, and can cause problems in recursive-call situations, but otherwise in practice is quite workable. And, since the data being passed reside in visible variables belonging to the object, their values can be conveniently observed in Viewers and Watchers, which can be quite a good debugging aid. Cheers, -- Scott _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland pastedGraphic.tiff (210K) Download Attachment pastedGraphic.tiff (311K) Download Attachment paramExample-sw.001.pr (73K) Download Attachment |
hi Scott,
thanks for reply when I download your pr file I get this message: "Reading an instance of MorphExtensionPlus, which modern class should it translate into" What should I do, I'd like to see your demo thanks, - Bill On Nov 7, 2007 11:55 AM, Scott Wallace <[hidden email]> wrote:
_______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
Hi, Bill,
Sorry for the confusion... the example is for use in an olpc etoys image -- see http://wiki.laptop.org/go/Etoys. As we announced last summer, our intention is to shift Squeakland users over to an olpc-based image this year (a large amount of work has gone into improving etoys for the olpc) but we have been so preoccupied with meeting one olpc deadline after another that we haven't finished following through on that yet. Cheers, -- Scott On Nov 6, 2007, at 6:13 PM, Bill Kerr wrote: > hi Scott, > > thanks for reply > > when I download your pr file I get this message: > "Reading an instance of MorphExtensionPlus, which modern class > should it translate into" > > What should I do, I'd like to see your demo > > thanks, > - Bill > > > On Nov 7, 2007 11:55 AM, Scott Wallace > <[hidden email]> wrote: > On Nov 1, 2007, at 3:50 PM, Bill Kerr wrote: > > > I can't assign a variable to the "add a parameter" feature available > > through the scripts menu in etoys. The parameter type is displayed > > and the type can be altered but it doesn't go green when I try to > > replace it with a variable of the right type. I can drag off a tile > > for the parameter type but that doesn't seem to help. > > Hi, Bill, > > I'm not sure I understand exactly what you're asking, but perhaps a > few general words about script parameters, and a simple example, will > be helpful... > > The "Tile for the parameter type" that you can drag from the header of > a Scriptor is actually a tile representing the parameter value > itself. You can drop such a tile at any type-appropriate place within > the body of the script. Thus, if the parameter type is "color", the > tile will be labeled "Color", and can be dropped on any Color-type > tile in the script, and if the parameter type is "number", the tile > will be labeled "Number" and can be dropped on any Number-type tile in > the script, etc. > > I attach a small example which illustrates use of a script parameter. > The script that has a parameter is called "wobble", and it takes a > numeric-valued parameter. Its role is to make the object turn by a > random amount within the limit specified by the parameter. The larger > the value of the parameter, the wider will be the variance. Notice > that in the body of the script, there are two places where a "Number" > tile, representing the value of the numeric parameter, is used. Both > of these "Number" tiles were obtained by dragging them from the > "number" tile in parameter area in the header, then dropping them on > numeric-valued tiles: > > > > > > A typical use of such a script can be seen in the two other scripts in > the example, one called "wideWobble", which calls "wobble" with a > parameter value of 70 (degrees), which makes for fairly wild random > wobble, and the other called "narrowWobble", which calls "wobble" with > a parameter value of 20 degrees, which makes for much less erratic > motion. > > Here's the script for "narrowWobble": > > > > > > > You can experiment with the behavior of these two scripts by holding > down the yellow "!" control for one or the other, or by first making > one of them "ticking", then observing the effect, then stopping that > script and making the other one tick, etc. Or, for a combined effect > (fwiw) make them both tick at the same time, perhaps at different > ticking rates. > > > BTW: we have successfully prototyped a much better UI for presenting > parameters to the user; the new design allows the user to *name* the > parameter, allows a *default value* for the parameter to be specified > in the scriptor's header, and (because of now having a default value) > also allows a script with a paremeter to be set "ticking". But > unfortunately we haven't had time yet to bring this into the > mainstream etoys system. > > > > I'm trying to make a fractal tree in etoys but need two parameters. > > Is it possible? > > No, sorry, only one parameter is allowed per script in this version of > etoys. > > The standard workaround for this is to pass the desired additional > parameter info in a *variable* which you add to the object for just > this purpose, and which you set in the caller, and which you "get" in > script itself. This requires extra bookkeeping by the person writing > the script, and can cause problems in recursive-call situations, but > otherwise in practice is quite workable. And, since the data being > passed reside in visible variables belonging to the object, their > values can be conveniently observed in Viewers and Watchers, which can > be quite a good debugging aid. > > > Cheers, > > -- Scott > > _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Bill Kerr
Hi,
you'll find two examples, polygon and tree, at: http://swiki.ofset.org:8000/super/uploads/OlpcRecursion.001.pr Note that handling recursion will often hang squeak. Use alt/dot keys to stop an infinite loop. player's Variables should only used as constants, they are not local variables. I'll try to use a container as heap to simulate local variables. Best regards -------- Message d'origine-------- De: [hidden email] de la part de Bill Kerr Date: mer. 07/11/2007 03:13 À: Scott Wallace Cc: squeakland org mailing list Objet : Re: [Squeakland] "add a parameter" script feature in etoys hi Scott, thanks for reply when I download your pr file I get this message: "Reading an instance of MorphExtensionPlus, which modern class should it translate into" What should I do, I'd like to see your demo thanks, - Bill On Nov 7, 2007 11:55 AM, Scott Wallace <[hidden email]> wrote: > On Nov 1, 2007, at 3:50 PM, Bill Kerr wrote: > > > I can't assign a variable to the "add a parameter" feature available > > through the scripts menu in etoys. The parameter type is displayed > > and the type can be altered but it doesn't go green when I try to > > replace it with a variable of the right type. I can drag off a tile > > for the parameter type but that doesn't seem to help. > > Hi, Bill, > > I'm not sure I understand exactly what you're asking, but perhaps a > few general words about script parameters, and a simple example, will > be helpful... > > The "Tile for the parameter type" that you can drag from the header of > a Scriptor is actually a tile representing the parameter value > itself. You can drop such a tile at any type-appropriate place within > the body of the script. Thus, if the parameter type is "color", the > tile will be labeled "Color", and can be dropped on any Color-type > tile in the script, and if the parameter type is "number", the tile > will be labeled "Number" and can be dropped on any Number-type tile in > the script, etc. > > I attach a small example which illustrates use of a script parameter. > The script that has a parameter is called "wobble", and it takes a > numeric-valued parameter. Its role is to make the object turn by a > random amount within the limit specified by the parameter. The larger > the value of the parameter, the wider will be the variance. Notice > that in the body of the script, there are two places where a "Number" > tile, representing the value of the numeric parameter, is used. Both > of these "Number" tiles were obtained by dragging them from the > "number" tile in parameter area in the header, then dropping them on > numeric-valued tiles: > > > > > > A typical use of such a script can be seen in the two other scripts in > the example, one called "wideWobble", which calls "wobble" with a > parameter value of 70 (degrees), which makes for fairly wild random > wobble, and the other called "narrowWobble", which calls "wobble" with > a parameter value of 20 degrees, which makes for much less erratic > motion. > > Here's the script for "narrowWobble": > > > > > > > You can experiment with the behavior of these two scripts by holding > down the yellow "!" control for one or the other, or by first making > one of them "ticking", then observing the effect, then stopping that > script and making the other one tick, etc. Or, for a combined effect > (fwiw) make them both tick at the same time, perhaps at different > ticking rates. > > > BTW: we have successfully prototyped a much better UI for presenting > parameters to the user; the new design allows the user to *name* the > parameter, allows a *default value* for the parameter to be specified > in the scriptor's header, and (because of now having a default value) > also allows a script with a paremeter to be set "ticking". But > unfortunately we haven't had time yet to bring this into the > mainstream etoys system. > > > > I'm trying to make a fractal tree in etoys but need two parameters. > > Is it possible? > > No, sorry, only one parameter is allowed per script in this version of > etoys. > > The standard workaround for this is to pass the desired additional > parameter info in a *variable* which you add to the object for just > this purpose, and which you set in the caller, and which you "get" in > script itself. This requires extra bookkeeping by the person writing > the script, and can cause problems in recursive-call situations, but > otherwise in practice is quite workable. And, since the data being > passed reside in visible variables belonging to the object, their > values can be conveniently observed in Viewers and Watchers, which can > be quite a good debugging aid. > > > Cheers, > > -- Scott > > > _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Scott Wallace
Hi,
Here is an example of recursion for squeakland Image (tree and polygon) using player's variables, http://swiki.ofset.org:8000/super/uploads/recursion.003.pr Enjoy Best regards -------- Message d'origine-------- De: [hidden email] de la part de Scott Wallace Date: mer. 07/11/2007 03:36 À: Bill Kerr Cc: squeakland org mailing list Objet : Re: [Squeakland] "add a parameter" script feature in etoys Hi, Bill, Sorry for the confusion... the example is for use in an olpc etoys image -- see http://wiki.laptop.org/go/Etoys. As we announced last summer, our intention is to shift Squeakland users over to an olpc-based image this year (a large amount of work has gone into improving etoys for the olpc) but we have been so preoccupied with meeting one olpc deadline after another that we haven't finished following through on that yet. Cheers, -- Scott On Nov 6, 2007, at 6:13 PM, Bill Kerr wrote: > hi Scott, > > thanks for reply > > when I download your pr file I get this message: > "Reading an instance of MorphExtensionPlus, which modern class > should it translate into" > > What should I do, I'd like to see your demo > > thanks, > - Bill > > > On Nov 7, 2007 11:55 AM, Scott Wallace > <[hidden email]> wrote: > On Nov 1, 2007, at 3:50 PM, Bill Kerr wrote: > > > I can't assign a variable to the "add a parameter" feature available > > through the scripts menu in etoys. The parameter type is displayed > > and the type can be altered but it doesn't go green when I try to > > replace it with a variable of the right type. I can drag off a tile > > for the parameter type but that doesn't seem to help. > > Hi, Bill, > > I'm not sure I understand exactly what you're asking, but perhaps a > few general words about script parameters, and a simple example, will > be helpful... > > The "Tile for the parameter type" that you can drag from the header of > a Scriptor is actually a tile representing the parameter value > itself. You can drop such a tile at any type-appropriate place within > the body of the script. Thus, if the parameter type is "color", the > tile will be labeled "Color", and can be dropped on any Color-type > tile in the script, and if the parameter type is "number", the tile > will be labeled "Number" and can be dropped on any Number-type tile in > the script, etc. > > I attach a small example which illustrates use of a script parameter. > The script that has a parameter is called "wobble", and it takes a > numeric-valued parameter. Its role is to make the object turn by a > random amount within the limit specified by the parameter. The larger > the value of the parameter, the wider will be the variance. Notice > that in the body of the script, there are two places where a "Number" > tile, representing the value of the numeric parameter, is used. Both > of these "Number" tiles were obtained by dragging them from the > "number" tile in parameter area in the header, then dropping them on > numeric-valued tiles: > > > > > > A typical use of such a script can be seen in the two other scripts in > the example, one called "wideWobble", which calls "wobble" with a > parameter value of 70 (degrees), which makes for fairly wild random > wobble, and the other called "narrowWobble", which calls "wobble" with > a parameter value of 20 degrees, which makes for much less erratic > motion. > > Here's the script for "narrowWobble": > > > > > > > You can experiment with the behavior of these two scripts by holding > down the yellow "!" control for one or the other, or by first making > one of them "ticking", then observing the effect, then stopping that > script and making the other one tick, etc. Or, for a combined effect > (fwiw) make them both tick at the same time, perhaps at different > ticking rates. > > > BTW: we have successfully prototyped a much better UI for presenting > parameters to the user; the new design allows the user to *name* the > parameter, allows a *default value* for the parameter to be specified > in the scriptor's header, and (because of now having a default value) > also allows a script with a paremeter to be set "ticking". But > unfortunately we haven't had time yet to bring this into the > mainstream etoys system. > > > > I'm trying to make a fractal tree in etoys but need two parameters. > > Is it possible? > > No, sorry, only one parameter is allowed per script in this version of > etoys. > > The standard workaround for this is to pass the desired additional > parameter info in a *variable* which you add to the object for just > this purpose, and which you set in the caller, and which you "get" in > script itself. This requires extra bookkeeping by the person writing > the script, and can cause problems in recursive-call situations, but > otherwise in practice is quite workable. And, since the data being > passed reside in visible variables belonging to the object, their > values can be conveniently observed in Viewers and Watchers, which can > be quite a good debugging aid. > > > Cheers, > > -- Scott > > _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
In reply to this post by Scott Wallace
thanks Scott, the wanderer demo is good, as is the OLPC etoys image
What I found with the number and function tiles in the OLPC image is that you have to drag them to the centre of whatever you are replacing before it changes to green (in the squeakland image drag to the edge seemed good enough) It also took me a while to find the function tile for the negativeOf function, the drop down images are quite small, although the mouse over pop up help is good Once you have done it and know how to do it, it becomes easy (of course). It was not easy for me first time even though I had your program telling me it was possible - I just had to find the right pieces and put them in the right places. There are 7 unused Number tiles on my desktop, representing failed attempts, LOL. Of course its probable that young kids would be faster than me, I don't deny that :-) Definition of easy: things you can do Definition of hard: things you can't do cheers, - Bill On Nov 7, 2007 1:36 PM, Scott Wallace <[hidden email]> wrote:
Hi, Bill, _______________________________________________ Squeakland mailing list [hidden email] http://squeakland.org/mailman/listinfo/squeakland |
Free forum by Nabble | Edit this page |