| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

eToy scripts 1

This version was saved 17 years, 5 months ago View current version     Page history
Saved by PBworks
on November 14, 2006 at 10:57:31 pm
 

Hi, Offray,

 

> We are also stuck on how to make copies on an eToy, so we work only on

> one, defining scripts, and animations and the we put the amount we

> want

> in the game. We know about the green halo button for copy, but we

> would

> like to use not graphically but from inside of a script. We have tried

> to use the message eToyName's copy but it can't be dragged on a

> script.

> The animations defined for the first eToy are not copied when we

> copy it.

 

When you execute "Car's copy", the result will be the creation of a

copy of Car (strictly speaking a "sibling", viz. a fellow instance of

the same class as Car.)

 

However, if you don't *place* that copy somewhere, you won't see it.

The standard idiom for placing an object somewhere via script is to

tell the *container* in which you place it to "include" it.

 

Here's a typical usage pattern:

 

-------------- next part --------------

A non-text attachment was scrubbed...

Name: unknown.png

Type: image/png

Size: 27055 bytes

Desc: not available

Url : http://squeakland.org/pipermail/squeakland/attachments/20061110/b0812a88/unknown.png

-------------- next part --------------

 



 

> Pdt: It seems that we're reaching some kind of stress point of the

> eToys. Would be nice to have the possibility to go from them to their

> code, but the scripts of the eToys seem to have only a code view,

> but is

> not usable for writing new code.

 

Hmm, well, etoy objects are first-class Smalltalk objects, and etoy

scripts are real, first-class Smalltalk methods, belonging to real,

first-class Smalltalk classes, and if you switch any script's

Scriptor to textual mode (by clicking on the checkbox in the

Scriptor's header,) you can enter any Smalltalk code you wish there.

 

A plausible practice is to use tile scripting for everything in a

project that *can* be readily done using tile scripts, then to

supplement this with conventional Smalltalk code in one or two places

where necessary.

 

Textual coding can actually be done using two kinds of scripts:

 

First, as mentioned above, you can write textual code for any

existing "etoy script" that you see in a Viewer by switching its

Scriptor to textual mode via the checkbox.

 

Secondly and this is not so well known you can open a conventional

Smalltalk browser on the class of an etoy "object", and using that

Browser you can not only see and edit the etoy scripts, you can also

add any other methods you wish, including methods with multiple

arguments (whereas etoy scripts are limited to 0 or 1 argument,) mid-

method returns, and many other things that you can't directly obtain

using tiles alone. To get such a Browser, in the Viewer's menu

choose "more..." and from the auxiliary menu that pops up, choose

"browse class."

 

I'm not claiming that this is the ideal way to transition from e-toy

tile-scripting to full-scale Smalltalk, if that's what your goal is

-- indeed, it may lead to false expectations; I just wanted to make

sure you're aware of the availability of these two ways of blending

tile-scripting with writing unrestricted Smalltalk code. It would be

interesting to hear of experiences people have had with this kind of

hybrid approach.

 

Cheers,

 

-- Scott

Comments (0)

You don't have permission to comment on this page.