Source language: Translate to:

Two correct entries required

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Two correct entries required

Postby seanie » Wed Jan 08, 2014 7:46 pm

Hello again, and Happy New Year!

I'm making a practice test for my students that is 'self-correcting' i.e. if they enter the correct answer in the text entry box, a tick is shown:

If "[TextEntry1]" "=" "correct answer" ShowObject "Picture1" "None" "0" (Picture 1 is the tick .. or 'check mark' for the Americans :-))

My problem is with sentences that have two text entry boxes. I can't seem to write a working command for BOTH text boxes to have correct answers before the tick is displayed, so I've been resorting to using two smaller ticks (one for each text entry box). This is kind of unsatisfactory.

I need something along the lines of If "[TextEntry1]" "=" "correct answer1" AND "[TextEntry2]" "=" "correct answer2" ShowObject "Picture1"

In other words, the tick will only be displayed if BOTH fields are filled correctly. How do I write the command for that? Please pardon my ignorance :-)
seanie
 
Posts: 47
Joined: Tue Jul 31, 2007 9:33 am

Re: Two correct entries required

Postby Odd » Thu Jan 09, 2014 12:04 am

Please see the IfEx statement for this purpose.

Another solution is to use nested If statements
If a = b
If c = d
(your code here)
EndIf
EndIf
User avatar
Odd
 
Posts: 81
Joined: Sat Apr 02, 2005 3:34 am
Location: Norway

Two correct entries required

Postby virger » Thu Jan 09, 2014 7:49 am

The simplest way
...[ans1] === correct
...[ans2] === correct
ifex "[ans1]-[ans2]=correct-correct OR [ans1]=correct OR [ans2]=correct"
bla bla bla
endif

From Costa Rica
Pura Vida
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 523
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Two correct entries required

Postby seanie » Thu Jan 09, 2014 4:24 pm

Odd wrote:Please see the IfEx statement for this purpose.

Another solution is to use nested If statements
If a = b
If c = d
(your code here)
EndIf
EndIf


Thanks Odd. Worked like a charm :-)
seanie
 
Posts: 47
Joined: Tue Jul 31, 2007 9:33 am

Re: Two correct entries required

Postby seanie » Thu Jan 09, 2014 4:26 pm

virger wrote:The simplest way
...[ans1] === correct
...[ans2] === correct
ifex "[ans1]-[ans2]=correct-correct OR [ans1]=correct OR [ans2]=correct"
bla bla bla
endif

From Costa Rica
Pura Vida


Muchas gacacias y Pura Vida :-)
seanie
 
Posts: 47
Joined: Tue Jul 31, 2007 9:33 am

Re: Two correct entries required

Postby David de Argentina » Thu Jan 09, 2014 6:04 pm

Hi,

Code: Select all
IfEX "[TextEntry1]=correct_answer1 AND [TextEntry2]=correct_answer2"
  . Both answers are correct. display de image.
Endif


Using AND operator, if true, both answers are correct.
Using OR operator, if true, ONE answer are correct

My 0.01
User avatar
David de Argentina
 
Posts: 1560
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest