Alice Community

Alice Community (
-   How do I...? (
-   -   Creating a multiple choice quiz (

RKengineer 03-28-2016 09:47 PM

Creating a multiple choice quiz
I would like to display a question and a list of choices, Then prompt the user for a choice. Can anyone provide an example?

RKengineer 03-28-2016 10:08 PM

Example of Multiple choice
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.

RKengineer 03-28-2016 10:22 PM

What version of Alice
I'm using Alice 3

RavenOfCode 03-29-2016 09: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! :)

chickentree 03-29-2016 04: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.


All times are GMT -5. The time now is 08:29 PM.

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