Page 1 of 1

tiny code problem

Posted: Wed Oct 23, 2013 4:21 pm
by chris25
I want to know the syntax for setting the objects at a certain start point when the user opens the card. This is as far as I can go:
Have searched PDF and other topics but can not find the correct syntax, have used all sorts of word combinations but this one eludes me....sorry, again it's a simple case of not knowing the correct question to ask, I am sure there is a reference somewhere.

on PreOpenCard
put/set/place grc "yellowOval" from/to/into/at 500,300 ???
put grc "RedOval" from 500,300
end PreOpenCard
on mouseUp
wait 2 seconds
set the lockMoves to true
move grc "YellowOval" from 450,330 to 530,69 in 240 ticks without waiting
move grc "redOval" from 450,330 to 100,69 in 200 ticks without waiting
set the lockMoves to false
end mouseUp

Re: tiny code problem

Posted: Wed Oct 23, 2013 8:42 pm
by Simon
Hi Chris,
In your preOpenCard it's
set the location of grc "yellowOval" to 450,330 (using the loc of your second set of scripts)

Simon

Re: tiny code problem

Posted: Wed Oct 23, 2013 8:51 pm
by chris25
Thankyou Simon, now that makes perfect sense. However I have been doing some reverse engineering using that wonderful breakpoint and out of curiosity could I also do this: (trying to exercise myself as much as possible here)

put the loc of grc "yellowOval" into beginPoint

at which time I then define what beginPoint is for the livecode engine? by making it a variable with the x y co-ordinates?

Thankyou

Re: tiny code problem

Posted: Wed Oct 23, 2013 8:58 pm
by Simon
Hi Chris,
...I then define what beginPoint is for the livecode engine?
I'm not clear on this question.
As you have your code now beginPoint is a variable that will contain the loc of grc "yellowOval"

For now please follow the technique of naming your variables with a prefix e.g. tBeginPoint. This will help you in the long run and really help others to be sure what you are talking about.
There is a list of prefixes that I can dig up for you somewhere.

Simon

Re: tiny code problem

Posted: Wed Oct 23, 2013 9:01 pm
by Simon
Here it is:
http://www.fourthworld.com/embassy/arti ... style.html
Under the Naming Conventions section.

Simon

Re: tiny code problem

Posted: Wed Oct 23, 2013 9:09 pm
by chris25
great resource thanks Simon. Ah yes the naming convention, I know consistency and clarity is important - but you should see what I am looking at, no naming convention here otherwise I would have most definitely picked up on it and would have recognised the variables by their prefixes.