want to make sure that I am understanding what I read

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, asayd

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

want to make sure that I am understanding what I read

Post by chris25 » Wed Oct 23, 2013 6:55 pm

I have been doing some reverse engineering in order to make sense of the parameters and general coding rhythms and movements of this whole area of coding. A rather large stack of code from Bouncy rev I am able to read up about and find in the dictionary, but the beginning of his code I was wanting just to make sure that I am understanding it correctly.

A number of points I wonder if someone could either confirm or correct for me please:
FROM bouncy rev

local tDragging -- true if dragging the window, false if not
local dx,dy -- the current x and y movement variable
local sx,sy -- the current x and y coordinates of the stack
local cx,cy -- the location at which the user clicked in the stack to start dragging
local sx0,sy0 -- when slingshotting, the start x and y
local tMessage -- the id of the message that moves the window
local tSound -- the path to the sound to play when bouncing
local leftBound,rightBound,bottomBound -- the boundaries to bounce within

-- Bouncy 1.0, copyright 2003 by Geoff Canyon
-- geoff@runrev.com
-- http://www.runrev.com
-- gcanyon@inspiredlogic.com
-- http://www.inspiredlogic.com

on openCard -- startup code
setMeUp
end openCard

on setMeUp -- set boundaries, etc.
put the width of this stack div 2 into leftBound
get the screenrect
put item 3 of it into screenright
put item 4 of it into screenbottom
put screenright - leftBound into rightBound
put the height of this stack div 2 into sh
put screenbottom - sh into bottomBound
put "invitation.aiff" into tSound
end setMeUp

The first section at the top at the beginning is where he has declared local variables by defining the names; these names he has invented for his own purpose?

-----------------------------------------------

on openCard
setMeUp
end openCard

"setMeUp" is not in the dictionary nor has he declared it as a variable

So I could say:
on OpenCard
TittywahaRules
end openCard

as long as I tell the scripting engine what "TittywahaRules" means?

Thankyou
regards
chris

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

Re: want to make sure that I am understanding what I read

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

Hi Chris,
The answer without an explanation is Yes.

On your second point
on OpenCard
TittywahaRules
end openCard
you can do but you must have an
on TittywahaRules
--do something
end TittywahaRules

Go ahead and replace all instances of "setMeUp" with TittywahaRules

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: want to make sure that I am understanding what I read

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

Ahhh, I missed something you said up there.
"setMeUp" is not in the dictionary nor has he declared it as a variable
setMeUp is a "Handler" not a variable (or other).

Page 123 of the User Guide.

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: want to make sure that I am understanding what I read

Post by chris25 » Wed Oct 23, 2013 10:06 pm

Is there another user guide because I have this on page 123

5.1 TheStructureofaScript
5.1.1 What is a Script

no mention about setmeup, which it does not return on entering into search box.

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

Re: want to make sure that I am understanding what I read

Post by Simon » Wed Oct 23, 2013 10:29 pm

Keep scrolling down and you'll came across Handlers.
5.4.2 has Custom Commands (which is what setmeup is) and Functions.

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: want to make sure that I am understanding what I read

Post by chris25 » Wed Oct 23, 2013 11:00 pm

oh...thankyou

Post Reply

Return to “LiveCode University”