General Intersect

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

General Intersect

RogGuay
Greetings,

I would like to find a simple way to determine if a button "target"  
intersects with any other button on the card.  Is there a way to script:


                          if intersect(button "target", any other  
button) then do something



I appreciate your help.

Cheers, Roger


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: General Intersect

TJ Frame
You can use the "intersect" function built into the language.
 - TJ

 On 8/21/05, Roger Guay <[hidden email]> wrote:

>
> Greetings,
>
> I would like to find a simple way to determine if a button "target"
> intersects with any other button on the card. Is there a way to script:
>
>
> if intersect(button "target", any other
> button) then do something
>
>
>
> I appreciate your help.
>
> Cheers, Roger
>
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: General Intersect

TJ Frame
PS: that works to check specific objects, if you want to test for a series
of objects, such as all buttons, use a repeat loop and cycle through your
list of potential targets for a hit.

On 8/21/05, TJ Frame <[hidden email]> wrote:

>
> You can use the "intersect" function built into the language.
>  - TJ
>
>  On 8/21/05, Roger Guay <[hidden email]> wrote:
> >
> > Greetings,
> >
> > I would like to find a simple way to determine if a button "target"
> > intersects with any other button on the card. Is there a way to script:
> >
> >
> > if intersect(button "target", any other
> > button) then do something
> >
> >
> >
> > I appreciate your help.
> >
> > Cheers, Roger
> >
> >
> > _______________________________________________
> > use-revolution mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-revolution
> >
>
>
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: General Intersect

Malte Brill
In reply to this post by RogGuay
Hi Roger,

as saied before you would do this with a repeat structure.

eg:

repeat with i=1 to the number of buttons
   if the short name of btn i="targetButton" then next repeat
   if intersect(btn "targetButton", btn i) then
     --do stuff
   end if
end repeat

However, if it is a time critical script and you have many buttons to
check, I suggest that you store the ID of all buttons you need to check
in a custom property and use repeat for each from there:

Assuming you have stored the IDs in a customProperty called
allButtonsToCheck, each ID on a seperate line:

repeat for each line theButtonToCheck in the allButtonsToCheck of this
card
   if theButtonToCheck=the ID of button "targetButton" then next repeat
   if intersect(button "targetButton", button ID theButtonToCheck) then
     --do stuff
   end if
end repeat

All the best,

Malte


---
ArcadeEngine - prepare to WOW your audience within minutes
http://www.runrev.com/section/revselect/arcadeengine
http://www.derbrill.com/arcadeengine/forum 

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: General Intersect

TJ Frame
Aso, If you might end up intersecting more than one button, you could create
a subset list of all buttons that match with something like the following:
 put 1 into counter
 repeat for the number of btns
 if the number of btn "targetButton" = counter then next repeat
 if intersect(button "targetButton", btn counter) then put the short id of
btn counter & cr after hitList
 add 1 to counter
end repeat
 --- each line of hitList will contain the id of a btn that intersects with
your target button
  this runs pretty fast. On my system, searching through 850 buttons took 18
milliseconds on average

 On 8/22/05, Malte Brill <[hidden email]> wrote:

>
> Hi Roger,
>
> as saied before you would do this with a repeat structure.
>
> eg:
>
> repeat with i=1 to the number of buttons
> if the short name of btn i="targetButton" then next repeat
> if intersect(btn "targetButton", btn i) then
> --do stuff
> end if
> end repeat
>
> However, if it is a time critical script and you have many buttons to
> check, I suggest that you store the ID of all buttons you need to check
> in a custom property and use repeat for each from there:
>
> Assuming you have stored the IDs in a customProperty called
> allButtonsToCheck, each ID on a seperate line:
>
> repeat for each line theButtonToCheck in the allButtonsToCheck of this
> card
> if theButtonToCheck=the ID of button "targetButton" then next repeat
> if intersect(button "targetButton", button ID theButtonToCheck) then
> --do stuff
> end if
> end repeat
>
> All the best,
>
> Malte
>
>
> ---
> ArcadeEngine - prepare to WOW your audience within minutes
> http://www.runrev.com/section/revselect/arcadeengine
> http://www.derbrill.com/arcadeengine/forum
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: General Intersect

RogGuay
In reply to this post by RogGuay
Thanks to all who responded.  I was hoping that I wouldn't have to  
use a repeat loop as I do have a time-critical situation.  However  
your suggestion of storing IDs as custom properties will perhaps save  
the day.

Cheers, Roger


On Aug 22, 2005, at 4:30 AM, [hidden email]  
wrote:

> as saied before you would do this with a repeat structure.
>
> eg:
>
> repeat with i=1 to the number of buttons
>    if the short name of btn i="targetButton" then next repeat
>    if intersect(btn "targetButton", btn i) then
>      --do stuff
>    end if
> end repeat
>
> However, if it is a time critical script and you have many buttons to
> check, I suggest that you store the ID of all buttons you need to  
> check
> in a custom property and use repeat for each from there:
>
> Assuming you have stored the IDs in a customProperty called
> allButtonsToCheck, each ID on a seperate line:
>
> repeat for each line theButtonToCheck in the allButtonsToCheck of this
> card
>    if theButtonToCheck=the ID of button "targetButton" then next  
> repeat
>    if intersect(button "targetButton", button ID theButtonToCheck)  
> then
>      --do stuff
>    end if
> end repeat
>
> All the best,
>
> Malte

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution