----- Original Message -----
From: "Jeremy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 10, 2001 9:12 PM
Subject: help with script needed
> I have a card that is full of buttons. I was wondering if there
> is any script (apart from a repeat script), that could return
> if a certain btn was within any of the other buttons, and if so
> return the name of that button?
>
> I tried using the repeat script, but this is a very slow thing
> to do, as it needs to be done at least once a second. I tried
> an intersect(cd btn a, any btn). But that appears to just test
> any random button..
(Please forgive the "baby talk" - I just like to put the cookies on
the bottom shelf if possible.)
It sounds like you want "collision detection".
MC issues a "mouseEnter" message when the mouseLoc "collides" with the
rect of a control, but I don't think there's a message issued when one
control's rect intersects another's rect. Or is there? Anyone?
It uses a "repeat", but I suppose you could check the moving control's
intersect state on every mouseMove message, assuming the control is
being moved by user with the mouse:
-- handler in script of the card or group that has all the buttons
on mouseMove
-- check the intersect 10 times per second
local tWhen
if the ticks < tWhen then pass mouseMove
put (the ticks + 6) into tWhen
-- only check buttons
if ("button" is not in the name of the target) then pass mouseMove
-- check the intersect state of the moving button RE other buttons
put (the number of the target) into tME
repeat with x = 1 to (the number of buttons)
if x = tME then next repeat
if intersect(btn tME, btn x) = false then next repeat
-- if the moving btn intersects another, do the following:
put x
end repeat
end mouseMove
The handler could be improved, but maybe it accomplishes what you're
trying to do.
Phil Davis
>
> Oh, and about my last post, i have not worked with quicktime
> before, so can anyone give me a script that plays midi's through
> quicktime?
>
> Thanks again for all your help.
>
>
> ____________________________________________________________________
> Get free email and a permanent address at
http://www.netaddress.com/?N=1
>
> Archives: http://www.mail-archive.com/[email protected]/
> Info: http://www.xworlds.com/metacard/mailinglist.htm
> Please send bug reports to <[EMAIL PROTECTED]>, not this list.
>
>
Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.