Page 1 of 1

Intersect

Posted: Tue Nov 05, 2013 8:51 pm
by chris25
on mouseUp
put the loc of btn "mover" into startloc
repeat until intersect (btn "mover", btn "theTarget") = "true"
get the loc of btn "mover"
set the loc of btn "mover" to (item 1 of it + 1) & "," & (item 2 of it)
-- adding 1 to this item 2 makes it move diagonally EG (item 2 of it +1)
wait 0.25
end repeat
set the loc of btn "mover" to startloc
end mouseUp

This script I culled from a tutorial by Dave from 2012 when I was looking up about two objects colliding instead of passing through each other, I understand the tutorial he gives except for this one point here below:

As you can see the intersect here is actually a function, but the problem here is that when I click on the word in the IDE the documentation brings it up as a Command.

thankyou
chris

Re: Intersect

Posted: Tue Nov 05, 2013 9:03 pm
by Simon
Good catch Chris.
Try looking up "intersect" in the dictionary, use the dictionary search box not the pop-up from the documentation tab.
Intersect is a keyword, command and function. You are using it as a function.

You can study the command and keyword types.

Simon

Re: Intersect

Posted: Tue Nov 05, 2013 9:27 pm
by chris25
wow, you mean I actually did something right?

Re: Intersect

Posted: Wed Nov 06, 2013 12:19 am
by dunbarx
wow, you mean I actually did something right?
I am afraid that this sort of thing will happen more and more often.

But to Simon's point, it is very instructive to read about this single word and how it manifests itself in three ways. You will soon become more familiar, and more comfortable, with the nuances of the language. In English, one of the most powerful aspects of its syntax is that a word may be a noun, a verb or an adjective. This give enormous power and flexibility, once you know it.

When you have the opportunity, and I might suggest it when it comes up, you simply must write a handler that uses a custom command, and then rewrite that very thing as a function. Then you will no longer be a newbie.

Craig

Re: Intersect

Posted: Wed Nov 06, 2013 1:09 am
by chris25
noted craig, in my journal.