I'm currently creating a quiz application and have the app setup to ask questions starting from 1 to X each time but I would like the questions to be random each time and at the end of the total answers to go to a navigation screen. I have unsuccessfully tried to do this previously as the random functioned seemed to work, but didn't know when to stop!
I've attached images of my blocks and would appreciate it if anyone could have a look and point me in the right direction? The screenshots are before I added the random function.
--
The screenshots are before I added the random function.
It would really help if you provided a screenshot of your relevant blocksafter adding the random function, so we can see what you are trying to do, and where the problem may be.
--
Apologies for the previous pictures, they were a little muddled.
The error I get (which from memory works sometimes if i change the greater than number? i've tried lots of different ways with little success) is the operation pick random item cannot accept the arguments: My first question in the list.
--
the pick a random item block expects a list and not a list item...
also you like to get the corresponding question text to the random question, don't you?
which means, it does not make sense to use the pick a random item block inthis case...
let me recommend to use the random integer block instead, see also this example How to pick a random item from a list without picking duplicates?
removerandom.aia
removerandom.aia
--
Thank you.
--
One follow up question. Will I need to apply exactly the same blocks in the link to my screen initialize block and next button block? That's when I want the first question to appear and the next button to grab the next question.
--
yes...
as you can see, there is some redundancy...
you can create a procedure which gives you a random index and call that procedure in both events...
--
to display the answer, do not get a new index, use the existing index to display the correct answer
also you can create a "next" procedure to be called from the initialize and NextButton.click event to avoid redundancy
--
Thanks Taifun, from the link you provided (and a little trial and error), i've got it working perfectly.
I have a couple more follow up questions (sorry for being a pest):
How do I enable the notifier button to go back to a menu once all the questions have been asked (i've used both variations of the attached screen shot)?
Is it possible to apply a style to the notifier (external style sheet or markup)?
Given a menu with multiple options, how would I choose a different list/s as my index (i currently have 8 screens per quiz section) on selection of a menu item?
Finally (phew!), is it possible to apply basic styles to the list text (comma separated) using a style sheet or markup?
--
which options do you display in the notifier? if you display "Menu" as one option, then using the text block "Menu" should work
--
to use a notifier component would not make sense there...
New formatting possibilities with the Notifier
New formatting possibilities with the Notifier
Given a menu with multiple options, how would I choose a different list/s as my index (i currently have 8 screens per quiz section) on selection of a menu item?
sorry, I don't understand this
is it possible to apply basic styles to the list text (comma separated) using a style sheet or markup?
no, but there is this workaround A powerful Label Alternative including touch gestures using the Webviewer, some HTML/jQuery andHammer.js
--
If you have 8 screens PER quiz section, that implies that you have MANY screens... The maximum you should use in AI is 10. Please read my tips on screens...
For my App Inventor Tips, visit TwoDogApps.com by clicking here!
For my App Inventor Tips, visit TwoDogApps.com by clicking here!
--
I've attached a screenshot of my notifier block. I was trying to launch the notifier on the end of the quiz (which works), but the button (I was using both blocks in the above post to test) just dismisses the notification.
To explain a bit better, my main screen is a menu with 8 buttons (each button represents a topic), on button press a new screen opens with the blocks from my random quiz. I have a single screen for each topic. Each of those screens currently has a question/answer list with different csv's. Rather than having eight screens, is there a way to dynamically choose a different list depending on which menu button is chosen?
--
Thanks Enis, some helpful tips!
--
You need a show choose message instead of a show message dialog, else the after chosen event will not fire
Rather than having eight screens, is there a way to dynamically choose a different list depending on which menu button is chosen?
depending on the chosen menu button load the question and answer list from the csv files, like this you could do everything in only one screen without redundancy
--
That's what i would like to do! Do you have any links to a tutorial or example on how to achieve this?
--