Scripting problem

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
anmldr
Posts: 459
Joined: Tue Sep 11, 2012 11:13 pm

Scripting problem

Post by anmldr » Fri Jul 18, 2014 6:19 pm

I am on lesson 2 of the beginner sheepherder app. I had followed the video but got an error on the script. I thought that it was my error. Then I copy/pasted from the downloaded lessons this portion of the script:

Code: Select all

if intersect (button("sheep"&x), graphic"pen","255") is false and intersect(button"sheep"&x),group"groupControls","0") is false then exit repeat
         end if
This is a direct copy/paste. When I hit the Apply button there is this error:
card id 1002: compilation error at line 17 (intersect: two objects are required) near "&", char 92
First, what is causing the error?
Second, for the portion
graphic"pen","255"
what does the 255 refer to and
Third, what does the 0 refer to in
group"groupControls","0"
Thank you,
Linda

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Scripting problem

Post by sefrojones » Fri Jul 18, 2014 6:23 pm

Maybe this? It looks like the second intersect is missing a parenthesis:

Code: Select all

if intersect (button("sheep"&x), graphic"pen","255") is false and intersect(button("sheep"&x),group"groupControls","0") is false then exit repeat


--Sefro


edit: 255 an 0 are levels of transparency I think. 255 being completely opaque and 0 being completely transparent.

Here's a link to some extra info about intersect:

https://sites.google.com/a/pgcps.org/li ... collisions


edit 2: moved parenthesis ... :oops:

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

Re: Scripting problem

Post by Simon » Fri Jul 18, 2014 6:42 pm

Close

Code: Select all

(button("sheep"&x), graphic"pen","255") ---first one
(button"sheep"&x),group"groupControls","0") --second
spot the missing parenthesis

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Scripting problem

Post by sefrojones » Fri Jul 18, 2014 6:48 pm

so....

Code: Select all

(button("sheep"&x),group"groupControls","0")

is correct yes? I haven't looked at the sheepherder lessons in quite a while.....

anmldr
Posts: 459
Joined: Tue Sep 11, 2012 11:13 pm

Re: Scripting problem

Post by anmldr » Fri Jul 18, 2014 7:17 pm

It was indeed a problem with parentheses.

Code: Select all

if intersect (button("sheep"&x), graphic"pen","255") is false and \
         intersect (button("sheep"&x),group"groupControls","0") is false then 
         exit repeat
         end if
Thank you for the link too.

Linda

Post Reply