Scripting Problems & Wishes
David N. Smith (IBM)
dnsmith at watson.ibm.com
Wed Oct 13 19:43:20 UTC 1999
I've been 'playing' with scripting, and having a lot of fun, and have
run into some problems or 'features', or have tried to do things that
I can't appear to do. I know it's all new, that I don't know it very
well yet, and that 2.6 may have changed it all; I'm still on 2.5
(with all updates applied). Anyhow, I hope no one minds of I mention
a few things I've run into.
* Highlighting button.
I've built a highlighting button by taking a rectangle morph and
adding scripts that change it's color. One triggered on mouseDown
changes it's color to the highlight color, and the other, triggered
on mouseUp, changes it back. Works fine. I added some text, imbedded
it, and locked it down. The button still works fine.
I then add a script for it to do something useful; in this case to
turn a Car. If the turn script triggers off of something besides
mouseDown or mouseUp then the button still highlights. But if I
trigger off of mouseDown then it turns the car but forgets how to
highlight itself. If I change the trigger of the turn script to
something else, the button still won't highlight even though the
scripts appear to have but one mouseDown again.
To fix it I have to reselect mouseDown for the highlighting script.
So, two problems here:
- There can be but one script on a morph for each mouse action.
- The system forgets to reenable other scripts with the same mouse
trigger when one changes.
* Duplicating the highlighting button
Using the halo's duplicate operation, I made a copy of the
highlighting button (which contains a reference to a Car morph;
pressing the button turns the car). I was going to change it to turn
the car the other direction. Result:
- The button is duplicated AND the car is duplicated.
There are two cars and I can run and turn each separately. I expected
two buttons that turned the same car. The two car morphs have the
same name, 'Car', but separate existence and separate viewers.
Is this the proper action?
* Dragging
I've tried to build a car with a steering wheel that I can drag
around in a circle like one moves a real steering wheel. (The example
discussed here in August was quite neat, but it requires that halo's
be accessible, and in a packaged product they won't.)
- There is no way to specify a mouseDrag operation.
I'd expect, I think, for it to trigger its script while dragging (say
at each tick). The script could see the current position (and maybe a
delta). For rotation (see below) it would see a change in orientation
(and maybe a delta).
* Rotation
On several things I've wanted to try, I wanted a morph to have a
center of rotation. On one, it would have to be external from the
morph (as in a handle that rotates around a hidden shaft). It's true
that one can rotate a morph, but only about its center.
- There is no way to specify a center of rotation.
* Hitting the wall
There seems to be no way to make a script that runs when a moving
object hits the wall, though something clearly happens from all the
noise it makes! :-)
I've had various other problems but I can't duplicate them. Twice
there has been a recursion that ran the VM out of memory, and it
seemed to have something to do with scripting.
Dave
_______________________________
David N. Smith
IBM T J Watson Research Center
Hawthorne, NY
_______________________________
Any opinions or recommendations
herein are those of the author
and not of his employer.
More information about the Squeak-dev
mailing list
|