Hi,
I'm trying to write code so that when a user presses return in a field, if what was entered in that field is any word in a specific variable that contains multiple words, a then statement will be triggered.  Currently the code is written so that when a user presses return in the field, the then statement will only be triggered if what was entered into the field matches exactly what is in the variable.
Currently the code looks like this-
 on returninfield
   if line 1 of me = varBrandname then 
      show field "correct"
      add 20 to varWinScore
      add 1 to gamePart
      put the seconds into varEndTime
      put false into varGameActive
      ComputeScore
      
      wait 2 seconds
      hide field "correct"
      show field "class label"
      show field "classguess"
      focus on card field "classguess"
      put the seconds into varStartTime 
      
   else
      show field "wrong"
      wait 2 seconds
      hide field "wrong"
      put empty into me
      focus on me
   end if
   put true into varGameActive
   computeTime
end returninfield
Any thoughts or suggestions?  This is my first time posting so I apologize for anything that does not make sense.
Thansk!
			
			
									
									
						on returninfield need any word to trigger then statement
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: on returninfield need any word to trigger then statement
I actually may have resolved the problem by using the operator 'is among'.
So, now it looks like
if line 1 of me is among the words of varBrandname then
show field "correct"
add 20 to varWinScore
add 1 to gamePart
put the seconds into varEndTime
put false into varGameActive
ComputeScore
If anyone has any feedback though, I would be glad to hear it!
Thanks!
			
			
									
									
						So, now it looks like
if line 1 of me is among the words of varBrandname then
show field "correct"
add 20 to varWinScore
add 1 to gamePart
put the seconds into varEndTime
put false into varGameActive
ComputeScore
If anyone has any feedback though, I would be glad to hear it!
Thanks!