At 18:22 +0800 04/10/2002, noelle cheng wrote:
>I do not know whether this question has been asked before but how do
>I start learning lingo scripting?
Heck, you have all the good questions, doncha? ;) It doesn't hurt to
start with some net surfing; I've got a few links to a few sites on
nightwares (URL in the sig). I've also got an intro there. It's more
of a whirlwind tour of Director than an actual intro to programming
Lingo specifically.
Director is a multi-faceted tool; it's not just Cast, not just Score,
not just Stage and not just Lingo. It's how all those pieces come
together to make a production of some kind or other. And depending on
how you approach Director itself, what you do might be
cast-intensive, or score-intensive, or lingo-intensive.
There are some good books out there. Pretty much anything written for
8 and 8.5 is great. Tab Julius, our esteemed listowner, wrote a book
called _Lingo_ for Director 5, but it's so damned well put together
it's still relevant. The same is true of the nutshell twins by Bruce
Epstein, Lingo in a Nutshell and Director in a Nutshell. Peter Small
wrote an intermediate-to-advanced text called _Lingo Sorcery_ that,
if nothing else, will get you thinking about Director in new ways.
Those texts might be available at a used bookshop.
David Menennoh (I believe I got his last name right) has written a
pretty hefty general-purpose tome for 8.5. James Newton has written a
guide for 3D and imaging lingo. And you've already found my
beginner's guide. Hint: Try ordering from Amazon. It'll probably be
cheaper.
Oh, I have chapter samples from the beginner's guide online. You can
poke over them and see what you think. The general approach I took
was to start with the assumption the reader had effectively zero
programming experience. Part 1 is a discussion of Director's tools
(including a chapter on the debugger); Part 2 gets you going with
Director in general as a programming environment (including Lingo);
Part 3 gets deeper into it with Lingo; and Part 4 covers OOPy stuff,
MIAW and so on.
>I realize that it was the author of the book 'A Beginners' Guide'
>who answered my questions (and maybe, its' technical editor too, I'm
>not sure - however the name appears to be the same) so it may be
>quite awkward to ask them.
Yeah, Kerry was the tech editor on my text. You should have seen the
comments he sent *me* about stuff I'd written! ;)
>Will buying a book and studying it be useful?
Most decent computer programming texts will stop you from time to
time and advise you to go to the machine and try things out. That's
really the most important thing to remember. The book might be
brilliantly-written but if you never actually sit down and do the
things illustrated in its pages, it won't have any value for you.
That's to be expected -- you don't learn ballet by reading about it.
;)
That said I believe you'll find all the intro texts and intermediate
texts for Director are pretty good. I'm not trying to be egotistical
there either...
Now to your other question. It would appear that you've got your
sprites (the buttons you're wanting to program) spanning across
multiple frames in the Score (I'd guess 28 frames) and that the code
you've attached to them is attached to only part of their span.
This is important because the 'beginSprite' and 'endSprite' stuff in
a behavior is not entirely aptly named. It would be better to think
of it as 'beginAttach' and 'endAttach' -- the behavior code activates
only at the point it's first attached in the Score, and deactivates
when it is detached. It's not locked to a sprite span; it is locked
to its own span of frames. This means you can have a sprite spanning
from frame 5 to 15, but if you've hot a behavior attached only at
frame 10, that's the only place in the entire sprite's duration where
the behavior will have any effect. (More or less!)
So the first thing to do would probably be to shorten the span of
frames your buttons occupy so they are down to just one frame. At the
end of their spans right now you should see either a little circle or
a little rectangle, terminating a line. Those are 'handles' of a sort
and can be used to drag the sprite's span to a longer or shorter
duration.
Drag both sprites' spans so they each occupy one frame (the same
frame) and, in the frame script channel at the top of the score, make
sure to add this behavior:
on exitFrame me
go the frame
END exitFrame
This should keep Director on the one frame occupied by your two
button sprites. Then, assuming sprite 'b' is still in position number
250, you should be able to use the rest of the code as before.
A tip on debugging. Two actually:
1. Try to simplify. Start by making a brand new Director movie that
has just those two buttons in it and a go the frame script. Get it
working there first, then apply what you learned to your overall
production. Sometimes isolating a single case can open your
uinderstanding of how something else is interfering with your work
elsewhere. Lingo crosstalk, perhaps.
2. Try out the debugger. Set a breakpoint in the endSprite handler of
button sprites a and b. See where those endSprite handlers are being
called. Odds are good they're happening someplace other than where
you expect.
Hope this helps!
--
Warren Ockrassa | http://www.nightwares.com/
Director help | Free files | Sample chapters | Freelance | Consulting
Author | Director 8.5 Shockwave Studio: A Beginner's Guide
Published by Osborne/McGraw-Hill
http://www.osborne.com/indexes/beginners_guides.shtml
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]