[etoys-dev] References in textual scripts (was: Another pass in the Etoys Reference Manual: tiles)

Bert Freudenberg bert at freudenbergs.de
Mon Dec 10 08:37:47 EST 2012


On 2012-12-07, at 22:55, Edward Mokurai Cherlin <mokurai at sugarlabs.org> wrote:
> I have an unanswered question that I would like help with. If I am
> writing Squeak code in a text tile, how do I refer to other Etoys
> objects? I have tried looking up their player and costume names, but
> that doesn't seem to work as I expected it to. 

Currently, an object has to be used in a tile script once before it can be used in a textual script. I typically make a textual script first, throw in tiles from all the objects I need to use, then switch to textual mode and start editing. Another way is to make a new throw-away script and drop some tile from the object you want to reference in, then switch it to textual mode. That will reveal its player's reference name.

Behind the scenes this creates a (weak) reference to the player in the world's reference pool using a player's #uniqueNameForReference method. You can inspect "self referencePool" in a textual script to see all known references for a project.

A nice addition would be if dropping an object onto a textual script would insert its player's reference name. Or maybe you could even drop an entire message tile and it would insert its textual equivalent.

- Bert -




More information about the etoys-dev mailing list