[etoys-dev] SQ-903 - Object displayed name does not always match name used to refer to object in scripts

Steve Thomas sthomas1 at gosargon.com
Fri Mar 25 03:34:32 EDT 2011


Scott,

Thanks, using this works fine (mostly),

On Wed, Mar 2, 2011 at 5:28 AM, Scott Wallace
<scott.wallace at squeakland.org>wrote:
>
>        catPlayer := ActiveWorld presenter reallyAllExtantPlayersNoSort
> detect:
>                [:p | p costume externalName = 'Cat'] ifNone: [nil].
>        catPlayer ifNotNil: [  catPlayer forward: 5  ]


Except when I have multiple Players with the same name in the project. For
example if I have a Player with the ExternalName 'Cat' on page 1 and another
Player with the ExternalName 'Cat' on page 2.  Then execute the script on
Page 2 the 'Cat' on Page 1 moves forward. (Note: in playing around with this
at one point the 'Cat' on page 2 did move, but when I renamed the 'Cat' and
made a new one it went back to the behavior where the 'Cat' on page 1 moved
again.

I changed the script to refer to 'Page' instead of 'ActiveWorld' and that
seemed to solve the problem, until I duplicated the page (which causes 'Cat'
to become 'Cat1') and then renamed 'Cat1' to 'Cat' then the 'Cat' on the
previous page moved.

So is there anyway to specify the 'search order' for players where it looks
in its current ?World/Playfield? first?
Of course the simplest answer may be for me to avoid the problem and not use
books ;)

Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakland.org/pipermail/etoys-dev/attachments/20110325/bba502b1/attachment.html>


More information about the etoys-dev mailing list