How do I 'shorten' this script?

Jim Bufalini jim at visitrieve.com
Fri Mar 5 07:07:04 EST 2010


Jim Ault wrote:

> I don't understand the logic of always putting false into tMatch.
> 
> ------I can see the value of... ----
> put empty into tMatch
> ...
> repeat ......
>     get the backgroundcolor of grc tName of grp "A"
>    put (IT = the backgroundcolor of grc tName of grp "B") AFTER tMatch
> 
> then the answer could be
>     "truetruefalsetruetrue" in one dialog
> and you could see which ones were true or false
> 
> 
> Jim Ault
> Las Vegas
> On Mar 4, 2010, at 11:00 PM, Mark Wieder wrote:
> 
> > Phil-
> >
> > Close. That'll give you five answer dialogs. Try
> >
> > on mouseUp
> >    local tMatch
> >
> >    put false into tMatch
> >    repeat with x = 1 to 5
> >       put "A"&x into tName
> >       if the backgroundcolor of grc tName of grp "A" \
> >           = the backgroundcolor of grc tName of grp "B"
> >       then put false into tMatch
> >    end repeat
> >    if tMatch
> >    then answer "AnswerA"
> >    else answer "AnswerB"
> > end mouseUp
> >
> > --
> > -Mark Wieder

I think Mark meant to say *put true into tMatch* before the repeat.

What about (and this is again typing code into an email without testing ;-):

repeat with x = 1 to 5
    put (the background of grp ("A"&x) of grp "A" \
        =  the background of grp ("A"&x) of grp "B") \
        after tMatch
end repeat
if "false" is in tMatch then "AnswerB"
else "AnswerA"

Which is probably exactly what JimA is saying and why he says he can see
initializing tMatch with empty, before the repeat.

Aloha from Hawaii,

Jim Bufalini





More information about the use-livecode mailing list