Source language: Translate to:

Two correct answers for a TextBox

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Two correct answers for a TextBox

Postby seanie » Wed Dec 12, 2012 5:25 pm

Hello everyone.

This is a two-parter.

(1)
My students have to write some sentences (answers to questions) in a text box. I like my teaching apps to be 'self-marking', so I usually have a tick appear if the students write the correct answer. Putting in the action command for that is pretty easy. What I'm not sure how to do is modify the command for TWO (or more) possible correct answers. For example, all of the following are equivalent:

They are not happy.
They aren't happy.
They're not happy.

If this were the answer to a question, it seems a little unfair to the students not to allow all possibilities to show up as correct (by showing the hidden tick mark).

Can anyone enlighten me?

(2)
Is there any way to have quotation marks (" ") as part of a required text in a textbox?
seanie
 
Posts: 47
Joined: Tue Jul 31, 2007 9:33 am

Re: Two correct answers for a TextBox

Postby Gaev » Wed Dec 12, 2012 7:25 pm

Try and place this code in the Text Change section of the Text Entry Box.. say its variable (to store Text Entry contents) is called Answer3 ...
Code: Select all
SetVar "Answer3State" "Incorrect"
If "[Answer3]" "=" "They are not happy."
   SetVar "[Answer3State]" "Correct"
EndIf
If "[Answer3]" "=" "They aren't happy."
   SetVar "[Answer3State]" "Correct"
EndIf
If "[Answer3]" "=" "They're not happy."
   SetVar "[Answer3State]" "Correct"
EndIf
If "[Answer3State]" "=" "Correct"
   .. your command to make the tick appear goes here
Else
   .. your command to make the tick disappear goes here
Endif


In order to specify a double quotes character within a command ... use [#34] e.g. ...

SetVar "CorrectAnswer45" "Hello [#34]seanie[#34]"

... check out the section called "Using Special Characters" in the Help Manual (under the link called 'Understanding Actions and Variables") for details.
User avatar
Gaev
 
Posts: 3736
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Two correct answers for a TextBox

Postby seanie » Thu Dec 13, 2012 5:32 pm

Thank you very much Gaev. That looks like even more info than I needed, as it will not only control the tick but also give a score at the end. Yeah! Right now I'm not going to use the scoring, but I'll try to adapt it to just show the ticks. It's for students' lab work or homework, and I just want them to know immediately after typing whether their sentences are correct or not. Thanks again for sharing your knowledge.
seanie
 
Posts: 47
Joined: Tue Jul 31, 2007 9:33 am


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron