How do I 'shorten' this script?
Phil Davis
revdev at pdslabs.net
Fri Mar 5 01:27:27 EST 2010
Hi William,
You were almost there. The statement that sets the 'tName' variable
value AND the condition-check that uses it must BOTH be inside the
repeat loop, like this:
on mouseUp
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 answer "AnswerA"
else answer "AnswerB"
end repeat
end mouseUp
HTH -
Phil Davis
On 3/4/10 10:01 PM, William de Smet wrote:
> Hi there,
>
>
> I am having trouble with 'shortening' some script but don't know why.
>
> The first script works but the second one doesn't. What am I doing wrong?
>
> Thanks!
>
>
> Greetings,
>
>
> William
>
> *
> *
>
> *
> *
>
> *on mouseUp*
>
> *if* the backgroundcolor of grc "A1" of grp "A" = the backgroundcolor of grc
> "A1" of grp "B" and \
>
> *if the backgroundcolor of grc "A2" of grp "A" = the backgroundcolor of grc
> "A2" of grp "B" and \*
>
> *if the backgroundcolor of grc "A3" of grp "A" = the backgroundcolor of grc
> "A3" of grp "B" and \*
>
> *if* the backgroundcolor of grc "A4" of grp "A" = the backgroundcolor of grc
> "A4" of grp "B" and \
>
> *if* the backgroundcolor of grc "A5" of grp "A" = the backgroundcolor of grc
> "A5" of grp "B"
>
> *then* *answer* "AnswerA"
>
> *else* *answer* "AnswerB"
>
> *end* mouseUp
>
>
>
>
> *on* mouseUp
>
> *repeat* with x = 1 to 5
>
> *put* "A"&x into tName
>
> *end* *repeat*
>
> *if* the backgroundcolor of grc tName of grp "A" = the backgroundcolor of
> grc tName of grp "B"
>
> *then* *answer* "AnswerA"
>
> *else* *answer* "AnswerB"
>
> *end* mouseUp
>
--
Phil Davis
PDS Labs
Professional Software Development
http://pdslabs.net
More information about the use-livecode
mailing list