Intersect

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Intersect

Post by chris25 » Tue Nov 05, 2013 8:51 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Intersect

Post by Simon » Tue Nov 05, 2013 9:03 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: Intersect

Post by chris25 » Tue Nov 05, 2013 9:27 pm

wow, you mean I actually did something right?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Intersect

Post by dunbarx » Wed Nov 06, 2013 12:19 am

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

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: Intersect

Post by chris25 » Wed Nov 06, 2013 1:09 am

noted craig, in my journal.

Post Reply