Question about char and typing excercise

dunbarx at aol.com dunbarx at aol.com
Wed Mar 23 12:46:32 EDT 2011


Hi.


Do you get a compile error or does the script just not work? The code snippet is not enough for me to figure out what might not be compiling if that is the issue. You might have a missing line break character (\) after the "if" line.


You can condense your code quite a bit, but don't worry about that until you have it functioning.


Craig Newman





-----Original Message-----
From: William de Smet <williamdesmet at gmail.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Wed, Mar 23, 2011 10:38 am
Subject: Question about char and typing excercise


Hi there,

I am making a little two letter word - typing excercise and that works fine.

 if vArr = 97
  then
    if char 1 of fld "Word" is "a"
    then
    delete the first char of fld "Word"
   end if
end if
etc, etc ...

For a variation of this excercise I want NOT to delete the letter but
turn the letter green or red and then check for the next char of the
word.
I use:
 if vArr = 98 and char 1 of fld "Word" is "b" then  set the
foregroundcolor of char 1 of fld "Word" to green
 if vArr = 98 and char 1 of fld "Word" is not "b" then  set the
foregroundcolor of char 1 of fld "Word" to red

This is where I am stuck now.
How do I make the script work so that depending on the color of the
previous char the next char of the Word will be checked?
 if vArr = 112 and the foregroundcolor of char 1 of fld "Word" = green
and char 2 of fld "Word" is "p"
      then
         set the foregroundcolor of char 2 of fld "voorbeeld" to green
         end if

This doesn't work

Any idea's are welcome!

greetings,
William

_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 




More information about the use-livecode mailing list