Page 1 of 1

Execution Error: No Such Object

Posted: Thu Jun 28, 2018 9:49 pm
by Newbie1
The following is code for a Brick Breaker game I am developing, but I keep getting the error "Execution Error: No Such Object" and I have tried everything to solve it, but nothing has worked, and yes I have checked for naming and spacing errors. Does anyone know how to solve this problem?

Here's the code:
on moveBallx
if TF is true then
checkWall
checkBox
set right of graphic "BallTest" to right of graphic "BallTest" + x --This is the line that keeps saying: (Chunk: No Such Object, char 39)
send "moveBallx" to me in 1
end if
end moveBallx

Thanks.

Re: Execution Error: No Such Object

Posted: Thu Jun 28, 2018 9:57 pm
by Klaus
Hi Newbie1,

welcome to the forum!

I have to guess here, try using brackets first:

Code: Select all

...
set the right of graphic "BallTest" to (the right of graphic "BallTest" + x)
...
Best

Klaus

Re: Execution Error: No Such Object

Posted: Thu Jun 28, 2018 10:06 pm
by Newbie1
Klaus,
Thanks for the welcome!

I tried to implement the brackets in my code, but I got the same result. Is there anything else that you know of which could solve this error? Let me know if you need me to provide you with more code.Thanks.

Best

Newbie1

Re: Execution Error: No Such Object

Posted: Fri Jun 29, 2018 6:35 am
by jmburnod
Hi Newbie1,
x is a param which must contain an integer, try this

Code: Select all

on domoveBallx 
moveBallx 10
end  domoveBallx 

on moveBallx x 
....
set the right of graphic "BallTest" to (the right of graphic "BallTest" + x)
...
end moveBallx x
Best regards

Re: Execution Error: No Such Object

Posted: Fri Jun 29, 2018 7:48 am
by SparkOut
What happens in the checkWall and checkBox handlers?
Do they check for a collision and delete the graphic if so?
The graphic seems to have been deleted, so how do you handle exiting the loop? You send the handler again in 1. Maybe you should

Code: Select all

if "moveBallx" is not in the pendingMessages then
  send "moveBallx" to me in 1
end if

Re: Execution Error: No Such Object

Posted: Fri Jun 29, 2018 5:20 pm
by Newbie1
jmburnod and SparkOut,
Thank you so much for your help. Although I couldn't solve the error message, my teacher just said to leave it since he couldn't figure it out as well.

Best Regards,
Newbie1

Re: Execution Error: No Such Object

Posted: Fri Jun 29, 2018 5:44 pm
by jmburnod
Hi Newbie1,
I believe understand that is one homework.
What Klaus and Spatkout said
Please read your script one more and add this line after first line of your handler

Code: Select all

on moveBallx
   answer x
...
end moveBallx
and try this

Code: Select all

on StartMoveBallx
moveBallx 10
end StartMoveBallx

on moveBallx x
   answer x
...
end moveBallx
Good luck for next step