Folks,
I am working on a Etoys Tutorial similar to Etoys Challange and I want to be able to detect if certain tiles were used (or not used), so that I can provide "pop up" hints to users.
I tried creating a script on a "Scripting Tile Holder", but as soon as I move the "Scripting Tile Holder" the script disappears (literally, off the screen and it is removed from the object).
To recreate: Open Etoys Challenge, then create a script for one the Scripting Tiles (ex:Car forward by 10), then move the Scripting Tile with you mouse and the script disappears.
Another possible solution would be to somehow use reflection to see what is in a particular script, but I would need help in figuring out how to do that.
Thanks, Stephen
At Tue, 19 Jan 2010 00:25:37 -0500, Steve Thomas wrote:
Folks,
I am working on a Etoys Tutorial similar to Etoys Challange and I want to be able to detect if certain tiles were used (or not used), so that I can provide "pop up" hints to users.
I tried creating a script on a "Scripting Tile Holder", but as soon as I move the "Scripting Tile Holder" the script disappears (literally, off the screen and it is removed from the object).
To recreate: Open Etoys Challenge, then create a script for one the Scripting Tiles (ex:Car forward by 10), then move the Scripting Tile with you mouse and the script disappears.
Another possible solution would be to somehow use reflection to see what is in a particular script, but I would need help in figuring out how to do that.
I think this is a tricky one. As you found out, Scripting Tile Holder is transient. As soon as you pick it up, the green fringe around the tile goes away; it means that the Scripting Tile Holder for that tile goes away along with the scripts and tiles. One may think that the Phrase Tile (inside the Scripting Tile Holder) may retain the identity, but once it is dropped into a scriptor, it results in a copy of original and also loses scripts.
- One approach is to look at the scriptor and visit recursively the tree structure of tiles in there and found out what kind of commands (and Test) are used. If you want to go this way, I or somebody should be able to provide a short code snippet that does it.
- Another approach would be to make the playfield that contains these phrases intelligent, and whenever a phrase is taken out from it, it assumes that it is "used". (Not perfect because it may be just moved to the world). Again, if you want to go this way, I or somebody should be able to provide a short code snippet that looks at the elements in the playfield and tells you what kind of tiles inside.
I would guess that the first approach would be more "faithful" in guiding the user, but still there is a mechanism to compare the current situation and the goal and decide what kind of information to provide to the user...
-- Yoshiki
etoys-dev@lists.squeakfoundation.org