Question about char and typing excercise

William de Smet williamdesmet at gmail.com
Wed Mar 23 10:38:59 EDT 2011


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




More information about the use-livecode mailing list