Page 1 of 1

Why am I supposedly "missing a 'to'"?

Posted: Sun Dec 30, 2012 11:39 pm
by cascadesjohn
on mouseup
set the backgroundcolor of rectangle "MySquare" to random(255), random(255), random(255)
end mouseup

The above script I wrote for a button on the same card as a rectangle I've drawn and named "MySquare." My intention is to have the interior of the rectangle change to a random color every time I click the button. "button "Button": compilation error at line 2 (set: missing 'to'), char 31" is the error message I get.

I need help correcting this newbie mistake.

Also, when a character number is noted, as the 'char 31' does above, does that include spaces that separate words? Usually when I count I end up somewhere in the middle or a word and am more confused than ever.

Thanks.

Re: Why am I supposedly "missing a 'to'"?

Posted: Sun Dec 30, 2012 11:43 pm
by Simon
grc or graphic not rectangle

set the backgroundcolor of grc "MySquare" to random(255), random(255), random(255)

Simon

Re: Why am I supposedly "missing a 'to'"?

Posted: Mon Dec 31, 2012 12:46 am
by cascadesjohn
That did away with the error message (thanks), but I can't get the color to change.

Re: Why am I supposedly "missing a 'to'"?

Posted: Mon Dec 31, 2012 1:02 am
by Simon
In the inspector click on "Opaque".
Saw that one coming should have mentioned it as well.

Simon

Re: Why am I supposedly "missing a 'to'"?

Posted: Mon Dec 31, 2012 1:49 am
by dunbarx
Hi.

Spaces are counted.

Click on the error message itself, and the problem area in the offending line will hilite. Very helpful.

Craig Newman

Re: Why am I supposedly "missing a 'to'"?

Posted: Mon Dec 31, 2012 2:56 am
by cascadesjohn
Checked "Opaque" and, Hallelujah! That would've taken me quite a while to figure out on my own. Thanks.