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

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
cascadesjohn
Posts: 14
Joined: Sat Feb 14, 2009 11:25 pm

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

Post by cascadesjohn » Sun Dec 30, 2012 11:39 pm

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.

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

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

Post by Simon » Sun Dec 30, 2012 11:43 pm

grc or graphic not rectangle

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

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

cascadesjohn
Posts: 14
Joined: Sat Feb 14, 2009 11:25 pm

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

Post by cascadesjohn » Mon Dec 31, 2012 12:46 am

That did away with the error message (thanks), but I can't get the color to change.

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

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

Post by Simon » Mon Dec 31, 2012 1:02 am

In the inspector click on "Opaque".
Saw that one coming should have mentioned it as well.

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Mon Dec 31, 2012 1:49 am

Hi.

Spaces are counted.

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

Craig Newman

cascadesjohn
Posts: 14
Joined: Sat Feb 14, 2009 11:25 pm

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

Post by cascadesjohn » Mon Dec 31, 2012 2:56 am

Checked "Opaque" and, Hallelujah! That would've taken me quite a while to figure out on my own. Thanks.

Post Reply