tiny code problem

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, asayd

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

tiny code problem

Post by chris25 » Wed Oct 23, 2013 4:21 pm

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

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

Re: tiny code problem

Post by Simon » Wed Oct 23, 2013 8:42 pm

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
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: tiny code problem

Post by chris25 » Wed Oct 23, 2013 8:51 pm

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

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

Re: tiny code problem

Post by Simon » Wed Oct 23, 2013 8:58 pm

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

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

Re: tiny code problem

Post by Simon » Wed Oct 23, 2013 9:01 pm

Here it is:
http://www.fourthworld.com/embassy/arti ... style.html
Under the Naming Conventions section.

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: tiny code problem

Post by chris25 » Wed Oct 23, 2013 9:09 pm

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.

Post Reply

Return to “LiveCode University”