Sheep Herder
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Sheep Herder
Hello
I am new to this forum and to livecode. I have no programing experience but livecode seamed easy to learn.
I have bought the sheep herder tutorial from livecode Academy but i get this error: (intersect: two objects are required) near "&", char 83
I still get this error after i copy the code from the pdf I got for livecode.
I am using Livecode community 6.7
I am new to this forum and to livecode. I have no programing experience but livecode seamed easy to learn.
I have bought the sheep herder tutorial from livecode Academy but i get this error: (intersect: two objects are required) near "&", char 83
I still get this error after i copy the code from the pdf I got for livecode.
I am using Livecode community 6.7
Re: Sheep Herder
Hi 44www,
1. welcome to the forum!
2. Could you please post the relevant part(s) of the script that causes errors?
Not everyone has the Sheepherder stack at hand
Best
Klaus
1. welcome to the forum!

2. Could you please post the relevant part(s) of the script that causes errors?
Not everyone has the Sheepherder stack at hand

Best
Klaus
Re: Sheep Herder
Hello
I get the error here: if intersect (button("sheep"&x), graphic"pen","255") is false and intersect(button"sheep"&x),group"groupControls","0") is false then the problems seams to be in the red text.
I hope this helps you.
I get the error here: if intersect (button("sheep"&x), graphic"pen","255") is false and intersect(button"sheep"&x),group"groupControls","0") is false then the problems seams to be in the red text.
I hope this helps you.
Re: Sheep Herder
Hi 44www,
hmm, syntax looks correct!?
Sorry, no idea without looking at the rest of the stack/scripts.
Best
Klaus
hmm, syntax looks correct!?
Sorry, no idea without looking at the rest of the stack/scripts.
Best
Klaus
Re: Sheep Herder
The code so far:
local sLevel
on levelIncrease
put empty into sLevel
add 10 to sLevel
sheepGenerate
end levelIncrease
on sheepGenerate
lock screen
repeat with x=1 to sLevel
repeat
clone button templateSheep
set the name of the last button to ("sheep"& x)
set the loc of last button to random(320), random(480)
set the visible of the last button to true
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
delete button ("sheep"&x)
end repeat
end repeat
unlock screen
end sheepGenerate
local sLevel
on levelIncrease
put empty into sLevel
add 10 to sLevel
sheepGenerate
end levelIncrease
on sheepGenerate
lock screen
repeat with x=1 to sLevel
repeat
clone button templateSheep
set the name of the last button to ("sheep"& x)
set the loc of last button to random(320), random(480)
set the visible of the last button to true
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
delete button ("sheep"&x)
end repeat
end repeat
unlock screen
end sheepGenerate
Re: Sheep Herder
AH, I think I got it!
Ther are parens missing:
...
## if intersect (button("sheep"&x), graphic"pen","255") is false and intersect(button"sheep"&x),group"groupControls","0") is false then
if intersect (button ("sheep" & x), graphic "pen","255") is false and intersect(button ("sheep" & x)),group "groupControls","0") is false then
...
See the difference?
Hint: Add some spaces to your scripts for better readability!
Best
Klaus
Ther are parens missing:
...
## if intersect (button("sheep"&x), graphic"pen","255") is false and intersect(button"sheep"&x),group"groupControls","0") is false then
if intersect (button ("sheep" & x), graphic "pen","255") is false and intersect(button ("sheep" & x)),group "groupControls","0") is false then
...
See the difference?
Hint: Add some spaces to your scripts for better readability!

Best
Klaus
Re: Sheep Herder
The script that I put here was coppied from their pdf.... Great i paid for a lesson with errors in it. I thought about that too....
Re: Sheep Herder
So it works now?
Re: Sheep Herder
No the problem is still there
Re: Sheep Herder
The strange part is that I olso received a video tutorial. And in the video tutorial he doesn't get this error......
Re: Sheep Herder
Hm, OK, then it was not this...44www wrote:No the problem is still there
Re: Sheep Herder
Good news.
I instaled 6.5 and put this script :
Local sLevel
on levelIncrease
put empty into sLevel
add 1 to sLevel
sheepGenerate
end levelIncrease
on sheepGenerate
lock screen
repeat with x = 1 to sLevel
repeat
clone button templateSheep
set the name of the last button to ("sheep"& x)
set the loc of last button to random(320), random(480)
set the visible of the last button to true
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
delete button("sheep"& x)
end repeat
end repeat
unlock screen
end sheepGenerate
And it works fine.The problemed seamed to be with the 6.7(dp3)
I instaled 6.5 and put this script :
Local sLevel
on levelIncrease
put empty into sLevel
add 1 to sLevel
sheepGenerate
end levelIncrease
on sheepGenerate
lock screen
repeat with x = 1 to sLevel
repeat
clone button templateSheep
set the name of the last button to ("sheep"& x)
set the loc of last button to random(320), random(480)
set the visible of the last button to true
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
delete button("sheep"& x)
end repeat
end repeat
unlock screen
end sheepGenerate
And it works fine.The problemed seamed to be with the 6.7(dp3)
Re: Sheep Herder
And there is a new problem.
The code that is presented in the tutorial does the opposite of what the tutorial says that it does
.
I submitted a ticket , I hope they respond quickly........
The code that is presented in the tutorial does the opposite of what the tutorial says that it does

I submitted a ticket , I hope they respond quickly........
Re: Sheep Herder
Good news.
The problem with the script is me
. I was tired and didn't pay good atention to the tutorial and instead of > I placed a <......
Can someone explain this to me:
if the top of button ("sheep"&x) < the top of this card then
set the top of button ("sheep"&x) to the left of this card
end if
if the left of button ("sheep"&x) < the left of this card then
set the left of button ("sheep"&x) to the left of this card
end if
if the right of button ("sheep"&x) > the right of this card then
set the right of button ("sheep"&x) to the right of this card
end if
if the bottom of button ("sheep"&x) > the bottom of this card then
set the bottom of button ("sheep"&x) to the bottom of this card
Why in the blue code they are using < and in the red code they are using >. Does it have something to do with the right and left of the screen?
Thank you in advance.
The problem with the script is me


Can someone explain this to me:
if the top of button ("sheep"&x) < the top of this card then
set the top of button ("sheep"&x) to the left of this card
end if
if the left of button ("sheep"&x) < the left of this card then
set the left of button ("sheep"&x) to the left of this card
end if
if the right of button ("sheep"&x) > the right of this card then
set the right of button ("sheep"&x) to the right of this card
end if
if the bottom of button ("sheep"&x) > the bottom of this card then
set the bottom of button ("sheep"&x) to the bottom of this card
Why in the blue code they are using < and in the red code they are using >. Does it have something to do with the right and left of the screen?
Thank you in advance.
-
- Livecode Opensource Backer
- Posts: 447
- Joined: Mon Jan 23, 2012 12:46 pm
Re: Sheep Herder
This is because the left of the card is 0 and the top is also 0. This means that the top left of your card is the location 0,0
so if you do something like this in the message box:
It will give you a number in a format like this : 0,0,480,800
this is the left,top,right,bottom
Hopefully this helps,
Sefro
so if you do something like this in the message box:
Code: Select all
put the rect of this card
this is the left,top,right,bottom
Hopefully this helps,
Sefro