Page 1 of 1

Scripting problem

Posted: Fri Jul 18, 2014 6:19 pm
by anmldr
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

Re: Scripting problem

Posted: Fri Jul 18, 2014 6:23 pm
by sefrojones
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:

Re: Scripting problem

Posted: Fri Jul 18, 2014 6:42 pm
by Simon
Close

Code: Select all

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

Simon

Re: Scripting problem

Posted: Fri Jul 18, 2014 6:48 pm
by sefrojones
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.....

Re: Scripting problem

Posted: Fri Jul 18, 2014 7:17 pm
by anmldr
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