[Newbies] Mophic scripts tiles vs textual code
David H. Shanabrook
dhshanab at acad.umass.edu
Mon Jun 4 13:00:53 UTC 2007
This is getting clearer. So would a better approach be to add a
method for this class? Would I add a method for PasteUpMorph such as
showa: polyb. Looking at the following script, showa method would
show self, and hide the argument polyb? Then when writing the morph
code I can refer to this new method?
On 4 Jun 2007, at 07:10, Bert Freudenberg wrote:
> Etoys is a layer on top of Smalltalk, so in most cases you can
> (unfortunately) not use the regular Smalltalk coding tools
> directly. OTOH, it's Smalltalk after all so of course you *can*
> access everything ;)
>
> Also, the way you phrased it, it seems you may have missed the
> distinction between the the "player" which is the object that gets
> scripted, and the "morph" which is its costume. That distinction is
> not relevant to Etoys users but important if you do Smalltalk.
>
> The simplest thing to reference the *player*, the equivalent to
> "PolyB" in a textual scriptor, is
>
> References at: #PolyB
>
> To get at the *morph*, use
>
> (References at: #PolyB) costume
>
> Now that only works for morphs that actually *have* a player, that
> is, the morphs that are scripted.
>
> To reference any morph (and we're leaving the Etoys world with
> this) is to enable the "create textual references to dropped
> morphs" option in the Workspace's menu next to its close button.
>
> - Bert -
>
> On Jun 4, 2007, at 12:51 , David H. Shanabrook wrote:
>
>> Thanks, this worked and helped.
>>
>> So to extend this, and help my understanding, how do I refer to a
>> morph in a workspace? If I named the morph polyB, and I do
>> something like "hide PolyB" in the workspace it asks about PolyB.
>>
>>
>> On 3 Jun 2007, at 14:26, Bert Freudenberg wrote:
>>
>>> On Jun 3, 2007, at 19:50 , David H. Shanabrook wrote:
>>>
>>>> Hi.
>>>>
>>>> I am writing some simple morphic scripts. It would be
>>>> convenient to use smalltalk directly, so I toggle the script to
>>>> directly enter the code. But I am having problems, as it is not
>>>> working. If I uses tiles to create a script and then toggle
>>>> over to text mode, the script looks like this for script "showa":
>>>>
>>>> showa
>>>> self setX: PolyZb getX.
>>>> self setY: PolyZb getY.
>>>> self setHeading: PolyZb getHeading.
>>>> PolyZb hide.
>>>> self show
>>>>
>>>> I think when I type the script in directly it doesn't know how
>>>> to reference PolyZb (a polygon object I created).
>>>
>>> You need to reference an object at least once in another object's
>>> tile script to make it "known" to the scripting system (*). After
>>> that, you can just type the name.
>>>
>>>> Any help? How does this translation between morph object's name
>>>> and the internal SmallTalk name happen?
>>>
>>> It's "Smalltalk", btw., with a lower-case "t".
>>>
>>> - Bert -
>>>
>>> (*) More precisely, #uniqueNameForReference must have been sent
>>> to the object to put it into the global registry named "References".
>>>
>
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
More information about the Beginners
mailing list