On Thu, 22 Jul 1999, Karl Becker wrote:
> >I'm not sure what the problem is here (and suspect that it has a lot
> >to do with what happens in "doOtherStuff"), but as a general rule in
> >MetaCard, *never* use "wait until X" or "repeat until Y" where Y is
> >any user-initiated change. It's a horribly inefficient way to things
> >(the technical term is polling, which is the antithesis of the
> >event-driven model all GUIs and multi-tasking OSs are built on).
>
> Hmmm...okay...
>
> >You'll get much smoother response and consume a fraction of the CPU
> >time if you use the mouseDown/mouseUp/mouseRelease/mouseMove messages,
> >possibly in combination with "send .. in" for things that need to be
> >done periodically (e.g., making flashing buttons, or changing the
> >frame in a GIF at a non-standard rate). It's harder to develop this
> >way because the important routines end up getting scattered over
> >several handlers, but is the only way to go, especially for
> >time-critical applications like games.
>
> I'm not sure if I can do that at all, however. I need to have stuff
> going on even while the user isn't inputting any commands, when the mouse
> is totally still, no keys are pushed, and the user is sitting back in his
> chair drinking Sprite. Mostly for this I'm talking about my basketball
> game, where the player would be playing against a computer-controlled
> guy. I suppose the "send .. in" command could work for this somehow
> (I'd have to think awhile to get it to work how I'd want to) ...
Probably so, but as I said above, this is the way to go.
> Also, as far as the mouse handling works... the script that worked for me
> perfectly in HyperCard (it was in The Fishin' Hole 1.0) did NOT work
> like it did in HC when I directly imported the stack into MC. I just
> opened the script and looked at it, and I'm wondering if MetaCard just
> lets mouseDown/mouseUp/etc messages go thru to whatever object the mouse
> is above, even when a script is happening, since this was the case.
It shouldn't. It should work just like HyperCard. If it doesn't,
please send in an example as a bug report to [EMAIL PROTECTED]
> The
> bobber would do some stuff, and if you clicked (it had a little "if the
> mouse is down then play "whoa" " line in the script) , it wouldn't pick
> up the click. When the script was done, however, it sometimes would send
> a mouseUp message to the button the cursor was directly under, even if
> the user didn't click since the script ended. I'm not sure how well I'm
> explaining this... Well, I figured out a workaround to my problems in the
> casino game, but the basketball game will still have to be tackled... and
> heck, maybe C would be better to do that in, even...
If you've got the extra time (a lot of it) and the expertise, there
are many advantages to doing games in C or C++. But you should be
able to come up with a pretty close approximation in MetaCard with a
lot less work if you use its more advanced features.
Regards,
Scott
> > Regards,
> > Scott
>
>
> --------------------------------
> Karl Becker, [EMAIL PROTECTED]
> http://www.btigate.com/~funkboy/
> Featuring: Tiger's Eye Casino,
> MacBasketball, and The Fishin' Hole!
>
********************************************************
Scott Raney [EMAIL PROTECTED] http://www.metacard.com
MetaCard: You know, there's an easier way to do that...