[etoys-dev] References in textual scripts

Bert Freudenberg bert at freudenbergs.de
Wed Dec 12 06:02:31 EST 2012


Ah. That's a very old ticket. Glad you remembered it :)

Looking at the code it seems the reference pool was introduced by Yoshiki in 2007 as part of the OLPC effort. Maybe that was one of the reasons?

- Bert -

On 2012-12-12, at 08:34, karl ramberg <karlramberg at gmail.com> wrote:

> I  made a simple implementation of this, and it works pretty well.
> To be able to drop in players to reference them make the textual panes much more useful.
> 
> In http://tracker.squeakland.org/browse/SQ-161 talks about the possibility of losing the reference.
> That's why I asked about this issue. But I have tested to save and load a project into other images and
> that seemed to work fine. So far so good.
> 
> Karl
> 
> 
> On Tue, Dec 11, 2012 at 1:01 AM, Bert Freudenberg <bert at freudenbergs.de> wrote:
>> Huh? The reference pool is stored in the published project - why would we lose anything? The mechanism is there we just need to hook it up.
>> 
>> - Bert -
>> 
>> On 2012-12-11, at 00:53, karl ramberg <karlramberg at gmail.com> wrote:
>> 
>> > It should not be hard to insert the player name from a dropped tile,
>> > but we would still lose reference to the player during publishing and reloading of a project.
>> >
>> > Can you think of a way to keep the reference for published projects ?
>> >
>> > Karl
>> >
>> >
>> > On Mon, Dec 10, 2012 at 2:37 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
>> >> 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