Jump to content
Macro Express Forums

Loop


blimey
 Share

Recommended Posts

Hi I am collecting input from a multiple choice menu the answers being say, A B C D. Correct entries can be A&C A&D B&C B&D, any other combinations are incorrect.

 

The input is stored in a variable, and then in a series of nested if else statements the input is measured against 1 of the above.

 

How do I make it so that any incorrect answers loop back to the original menu question?

 

Ta for your help.

Link to comment
Share on other sites

Hello blimey

 

I think you have to use Switches and Cases.

 

This is how I would do it:

 

 

Repeat Until %T2% = "OK"

Multiple Choice Menu: Choose!

Text Box Display: Answer

Switch (T1)

// IF Correct :)

Case: AC

Variable Set String %T2% "OK"

Text Box Display: Correct!

End Case

Case: AD

Variable Set String %T2% "OK"

Text Box Display: Correct!

End Case

Case: BC

Variable Set String %T2% "OK"

Text Box Display: Correct!

End Case

Case: BD

Variable Set String %T2% "OK"

Text Box Display: Correct!

End Case

// IF Wrong

Default Case

Text Box Display: Incorrect!

End Case

End Switch

Repeat End

Text Box Display: Finished

 

 

<REP3:08:000001:000001:0002:0:01:OK><MENU2:2:F:01:CenterCenter:Choose!Correct Answers:
AC AD BC BDA
B
C
D><DIS:<TBOX4:T:1:CenterCenter000278000200:000:Answer%T1%><SWITCH:T1><REM2:IF Correct :)><CASE:AC><TVAR2:02:01:OK><TBOX4:T:1:CenterCenter000278000200:000:Correct!:D><ENDCASE><CASE:AD><TVAR2:02:01:OK><TBOX4:T:1:CenterCenter000278000200:000:Correct!:D><ENDCASE><CASE:BC><TVAR2:02:01:OK><TBOX4:T:1:CenterCenter000278000200:000:Correct!:D><ENDCASE><CASE:BD><TVAR2:02:01:OK><TBOX4:T:1:CenterCenter000278000200:000:Correct!:D><ENDCASE><REM2:IF Wrong><DEFCASE><TBOX4:T:1:CenterCenter000278000200:000:Incorrect!: (><ENDCASE><ENDSWITCH><ENDREP><TBOX4:T:1:CenterCenter000278000200:000:Finished>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...