Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Creating a multiple choice quiz
Old
RKengineer
Junior Member
 
Status: Offline
Posts: 4
Join Date: Mar 2016
Location: Laurel, MD
Default Creating a multiple choice quiz - 03-28-2016, 08:47 PM

I would like to display a question and a list of choices, Then prompt the user for a choice. Can anyone provide an example?
   
Reply With Quote
Example of Multiple choice
Old
RKengineer
Junior Member
 
Status: Offline
Posts: 4
Join Date: Mar 2016
Location: Laurel, MD
Default Example of Multiple choice - 03-28-2016, 09:08 PM

I would like to display the text of a question, then multiple possible answers (one per line). Then prompt the user to select one choice. For example:

What would you like for lunch?
A) Peanut butter & jelly sandwich
B) Garden salad
C) Burger and fries
D) none of the above, I'm on a diet

The "say" procedure seems to be limited to displaying a single line.

I tried using the Billboard prop, but can't find a way to write on it.

Ideally, I would like to make it a re-usable function that can be called with an array of text strings: the question, multiple choices. The function would display these, prompt the user for a choice, and return the letter/number of the choice to the caller.
   
Reply With Quote
What version of Alice
Old
RKengineer
Junior Member
 
Status: Offline
Posts: 4
Join Date: Mar 2016
Location: Laurel, MD
Default What version of Alice - 03-28-2016, 09:22 PM

I'm using Alice 3
   
Reply With Quote
Old
RavenOfCode
Senior Member
 
RavenOfCode's Avatar
 
Status: Offline
Posts: 408
Join Date: Oct 2013
Location: Northern Virginia
Default 03-29-2016, 08:31 AM

Im not any good at Alice 3, I only used it for a few hours. Still from the coding perspective try using an int, 1 = first answer, 2 = 2nd answer, ect. Then use some 3D text with an array of strings to display the questions. After that just add some click detection. Use the int for checking if the answer is correct (just compare 2 ints).

For setting it easily to different questions, just make a method with 2 params, an int and an array of strings. Then set the correct answer to the int and the array of questions to the array.

If you have any more questions please ask!


Stuff + Other Stuff + Different Other Stuff = Things :)

My best Alice game:

Clash of the Cubes (an arena fighting game):
http://www.alice.org/community/showthread.php?t=10738&highlight=game

Last edited by RavenOfCode; 03-29-2016 at 08:35 AM.
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 210
Join Date: Dec 2012
Location: Frosno, Ca
Default 03-29-2016, 03:48 PM

I don't know Alice 3, but in 2 there is a property that holds the text. If you drag that property into a method you can change the text to whatever you want.
Also, at least in 2, there are world functions that allow you to convert numbers to strings and to combine strings.

Mark


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.