Trivia Round
Iterates through trivia questions, and users expecting user response
When to use?
Only available in trivia package
How to use:
- Make sure you've got an array containing trivia multiple-choice questions, possible answers and the correct answer and letter for each question
- If the game is a multiplayer, make sure you've got an array containing player names and scores (can be just initialized to zero)
- In the Questions field enter the expression to evaluate the questions array, like this: ${questions}
- if the game is a multiplayer, in the Users field enter the expression to evaluate the players array, otherwise, leave the field empty, for example: ${players}
- In the Status variable name enter the name under which you'll be able to access individual array items, for example: status
- In the Correct letter field enter the status expression to evaluate the correct letter, for example: ${status.question.correctLetterKey}
- In the Correct answer field enter the status expression to evaluate the correct answer, for example: ${status.question.correctAnswerKey}
- You can set the Skip reset field to true (or an expression that evaluates to true) to skip resetting status variables after the iteration is interrupted, for example: ${some_var}
- Block's main process phase and it's built-in intents are hidden, but you can add your own in the Additional Intents container
- You can add processors that don't trigger loop iteration in the Other Processors container, for example, processor for repeating questions
- To access current question, use this syntax: ${status.question.questionKey}
- To access current question answers array, use this syntax: ${status.question.answersKey}
- To access current question correct answer, use this syntax: ${status.question.correctAnswerKey}
- To access current question correct letter, use this syntax: ${status.question.correctLetterKey}
- (multiplayer) To access current player name, use this syntax: ${status.user.nameKey}
- (multiplayer) To access current player name, use this syntax: ${status.user.scoreKey}
- You can access current question index: ${status.question_index}
- (multiplayer) You can access current user index: ${status.user_index}
- To check if it's the last question, use this syntax: ${status.last_question}
Example of usage
We have a multi-dimensional questions array in this format: questions[index]["question"], questions[index]["answers"][index]["answer"], questions[index]["correct_letter"] etc.
We also have a multi-dimensional players array in this format: players[index]["name"], players[index]["score"]
- Questions ${questions}
- Users: ${players}
- Status variable name:status
- Correct letter:${status.question.correct}
- Correct answer:${status.question.correct}
- We want to output player name: ${status.user.name}
- And current multiple-choice question: ${status.question.question}
- To output all answers and their corresponding letters you can use a Loop element