Pub Quiz Project

So I’m trying to create a simple, quick pub quiz using Inform 7. I’ve downloaded Questions by Michael Callaghan and am using his Quiz Night sample as the basis. The trouble I’m having is setting up the questions. I’d like for the questions to be text input questions and have a defined answer but I can’t find anything about setting up a question table that way.

Is it impossible to set up text questions, rather than menu questions, as a table?

Here’s how you can adapt Quiz Night to allow free-form text:

[code]“Quiz Night” by Michael Callaghan

Include questions by Michael Callaghan.

The pub is a room. “The pub is crowded for the weekly quiz night. The barman is ready to call out the questions. Get one wrong and you will be barred from the pub for life.”

After looking for the first time:
follow the pub rule.

Table of quiz questions
Qn Correct
“In which year was the Battle of Hastings” “1066”
“What type of animal is Basil Brush” “Fox”
“What is the square root of 126736?” “356”
“How many books are there in the Old Testament” “39”
“What is a Cantaloupe?” “Fruit”

The expected answer is a text that varies.

Every turn when the location is the pub (this is the pub rule):
choose a random row in the table of quiz questions;
now current question is the Qn entry;
now expected answer is the correct entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub answer rule):
if the current answer is the expected answer:
if the table of quiz questions is not empty:
say “Well done. You have survived to the next round.”;
exit;
otherwise:
end the story finally saying “Congratulations you have won!”;
otherwise:
end the story finally saying “You have been barred from the pub for getting a question wrong.”.[/code]

Note that now the current answer is text that varies rather than a number that varies (since the player will be answering text rather than a number), and the table accordingly is only two columns. Also we have to change a bunch of things to reflect that we’re asking a text question rather than a menu question. And the tricky thing is that, as the documentation for the extension says, by default closed text questions retry rather than exit, so we need to explicitly tell the pub answer rule to “exit” (this is a phrase defined specifically by the Questions extension). That’s what ends the turn and allows the pub rule to cue up the next question,

That is one harsh barman.

No joke.

Huge thanks to matt w for the help. If you wouldn’t mind, may I pick your brain via PM?

Sure, although if you want to post here I’ll be happy to keep answering questions and they’ll benefit anyone else who has similar questions. Also, I’m grading finals this week, so it might take me a while to respond.

I would be happy to see questions asked and answered here. I learn a lot just by seeing the questions that other people ask and how they are answered. If you’re worried about clogging up the board or something like that… well, I think that’s kind of what they’re here for.

:smiley:

Looks like I’ll ask here in that case.

I’m wondering if it wouldn’t be possible to set up the questions and keep score with them, rather than a simple “kicked out of the bar” scenario.

I’ve gotten it to the point wherein I’m not kicked from the bar but I’d like to assign point values to different questions. Is this possible? I know games written in Inform 7 can keep score but I’m wondering if I can associate that with the questions.

I would imagine that you could just add another column to the Table of Quiz Questions indicating the point value. Then, when the player answers the question correctly, you could increment their score by that amount. You could also dock them points if they get the question wrong–say, for example, you want to take off half the number of points for a wrong answer.

I don’t know if I’m missing anything, but that’s what I would try first.

[code]“Quiz Night” by Michael Callaghan

Include questions by Michael Callaghan.
Use scoring

The Round1 is a room. "Welcome to Trivia, I’m your host, the disembodied voice coming from your device. We have only one rule; please don’t cheat. "

After looking for the first time:
follow the pub1 rule.

Table of quiz questions
Qn Correct
“According to the Old Testament, who spent 3 days and nights in the belly of a whale?” “Jonah”
“The Tom Green Show and 16 and Pregnant were originally aired on what network?” “MTV”
“The Soul and The Optima are both models by what auto make?” “Kia”
“Kim Jong Il, Joseph Stalin, or Mao Tsedong, which dictator ruled the longest?” “Mao Tsedong”

The expected answer is a text that varies.

Every turn when the location is The Round1 (this is the pub1 rule):
choose a random row in the table of quiz questions;
now current question is the Qn entry;
now expected answer is the correct entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub answer rule):
if the current answer is the expected answer:
if the table of quiz questions is not empty:
increase score by 5;
say “Well done. Next question.”;
exit;
otherwise:
say “That was Round One, now onto Round Two!”;
increase score by 5;
move the player to The Round2;
otherwise:
say “Incorrect. Next question.”;
exit

The Round2 is a room. “Now onto Round Two where the questions get slightly harder but are worth ten points a piece.”

After looking for the first time:
follow the pub2 rule.

Table of quiz questions2
Qn2 Correct2
"Get a Mac was an ad slogan for what company from 2006 to 2009? " “Apple”
“What is the capital of Egypt?” “Cairo”
“In the contract version of what card game are players identified by points on the compass?” “Bridge”
“What movie has the Highland Games, a Witch, and Craig Ferguson as Lord Macintosh?” “Brave”

The expected answer is a text that varies.

Every turn when the location is The Round2 (this is the pub2 rule):
choose a random row in the table of quiz questions2;
now current question is the Qn2 entry;
now expected answer is the correct2 entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub2 answer rule):
if the current answer is the expected answer:
if the table of quiz questions is not empty:
increase score by 10;
say “Well done. Next question.”;
exit;
otherwise:
say “That was the end of Round Two.”;
increase score by 5;
move the player to The Round2;
otherwise:
say “Incorrect. Next question.”;
exit[/code]

So this is what I’ve got so far now. The issue I’m running into is that it enters The Round2 as a room but doesn’t prompt questions. Also, if I answer the final question of The Round1 incorrectly, it hangs up and fails. Any idea for fixing those two issues?

Your Round2 problem comes from this:

After looking for the first time: follow the pub2 rule.

The thing about “looking for the first time” is that it triggers after the first looking action in the entire game–which takes place in order to print the room description of the first room, before the player has typed anything. So this is not going to fire when you want it to. You probably can just put “follow the pub2 rule” in the places in the code where you move the player to The Round2.

The other issue, I think, is that in this section of code:

otherwise: say "That was Round One, now onto Round Two!"; increase score by 5; move the player to The Round2;

you need to insert “exit” (probably before "move the player to The Round2) in order to end the turn, as before.

I’m not sure that will take care of everything, since I haven’t run the new code, but hopefully it gets you started.

So I’ve made the changes Matt W recommended and I’m getting some zany errors.

Any ideas?

The rulebook you’re using is called the “text question rulebook” or the “text question rules,” so when you want to make a rule for it you have to start it with “A text question rule”. You’ve got “A text question 1 rule” and “A text question 2 rule,” and the extraneous numbers are throwing the compiler off.

(I edited to put your image behind spoiler tags, because overly large images mess up the formatting of the website on laptop screens. In general, you can copy-paste error messages, so it’s OK to copy in your code and then copy in the text of the error message you got; no need for a screenshot.)

Got it on the huge images. I’ve got this to work after fixing the text question rule issue.

Now I’m getting this error when I finish the first round.

[code]“Quiz Night” by Michael Callaghan

Include questions by Michael Callaghan.
Use scoring

The Round1 is a room. "Welcome to The Trivia Guys, I’m your host, the disembodied voice coming from your device. We have only one rule; please don’t cheat. "

After looking for the first time:
follow the pub1 rule.

Table of quiz questions
Qn Correct
“According to the Old Testament, who spent 3 days and nights in the belly of a whale?” “Jonah”
“The Tom Green Show and 16 and Pregnant were originally aired on what network?” “MTV”
“The Soul and The Optima are both models by what auto make?” “Kia”
“Kim Jong Il, Joseph Stalin, or Mao Tsedong, which dictator ruled the longest?” “Mao Tsedong”

The expected answer is a text that varies.

Every turn when the location is The Round1 (this is the pub1 rule):
choose a random row in the table of quiz questions;
now current question is the Qn entry;
now expected answer is the correct entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub answer rule):
if the current answer is the expected answer:
if the table of quiz questions is not empty:
increase score by 5;
say “Well done. Next question.”;
exit;
otherwise:
say “That was Round One, now onto Round Two!”;
increase score by 5;
exit;
move the player to The Round2;
follow the pub2 rule;
otherwise:
say “Incorrect. Next question.”;
exit

The Round2 is a room. “Now onto Round Two where the questions get slightly harder but are worth ten points a piece.”

Table of quiz questions2
Qn2 Correct2
"Get a Mac was an ad slogan for what company from 2006 to 2009? " “Apple”
“What is the capital of Egypt?” “Cairo”
“In the contract version of what card game are players identified by points on the compass?” “Bridge”
“What movie has the Highland Games, a Witch, and Craig Ferguson as Lord Macintosh?” “Brave”

The expected answer is a text that varies.

Every turn when the location is The Round2 (this is the pub2 rule):
choose a random row in the table of quiz questions2;
now current question is the Qn2 entry;
now expected answer is the correct2 entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub2 answer rule):
if the current answer is the expected answer:
if the table of quiz questions is not empty:
increase score by 10;
say “Well done. Next question.”;
exit;
otherwise:
say “That was the end of Round Two.”;
increase score by 5;
move the player to The Round2;
otherwise:
say “Incorrect. Next question.”;
exit[/code]

In this rule:

A text question rule (this is the pub answer rule): if the current answer is the expected answer: if the table of quiz questions is not empty: increase score by 5; say "Well done. Next question."; exit; otherwise: say "That was Round One, now onto Round Two!"; increase score by 5; exit; move the player to The Round2; follow the pub2 rule; otherwise: say "Incorrect. Next question."; exit

your check for whether the table of quiz questions is empty is embedded in the “if the current answer is the expected answer” code block. That means that, when the player gets the last question wrong, it doesn’t check whether the table is empty–so instead of moving to round 2 it tries again with a blank table, and when it goes to choose one of the rows you get the error.

If I were you I would just move that check to the end of the whole rule, and supply two messages for every question; “well done/incorrect” depending on whether they got it right, “Next question/on to round 2” depending on whether the table is empty.

Still getting this error, sadly. I feel like such an idiot with this, asking it to be hand-fed to me. Again, thank you people for your help. You’ve been brilliant so far!

[code]“Quiz Night” by Michael Callaghan

Include questions by Michael Callaghan.
Use scoring

The Round1 is a room. "Welcome to The Trivia Guys, I’m your host, the disembodied voice coming from your device. We have only one rule; please don’t cheat. "

After looking for the first time:
follow the pub1 rule.

Table of quiz questions
Qn Correct
“According to the Old Testament, who spent 3 days and nights in the belly of a whale?” “Jonah”
“The Tom Green Show and 16 and Pregnant were originally aired on what network?” “MTV”
“The Soul and The Optima are both models by what auto make?” “Kia”
“Kim Jong Il, Joseph Stalin, or Mao Tsedong, which dictator ruled the longest?” “Mao Tsedong”

The expected answer is a text that varies.

Every turn when the location is The Round1 (this is the pub1 rule):
choose a random row in the table of quiz questions;
now current question is the Qn entry;
now expected answer is the correct entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub answer rule):
if the current answer is the expected answer:
if the table of quiz questions is not empty:
increase score by 5;
say “Well done. Next question.”;
exit;
otherwise:
say “That was Round One, now onto Round Two!”;
increase score by 5;
exit;
move the player to The Round2;
follow the pub2 rule;
otherwise:
if the table of quiz questions is not empty:
say “Incorrect. Next question.”;
exit;
otherwise:
say “That was Round One, now onto Round Two!”;
exit;
move the player to The Round2;
follow the pub2 rule;

The Round2 is a room. “Now onto Round Two where the questions get slightly harder but are worth ten points a piece.”

Table of round two questions
Qn2 Correct2
"Get a Mac was an ad slogan for what company from 2006 to 2009? " “Apple”
“What is the capital of Egypt?” “Cairo”
“In the contract version of what card game are players identified by points on the compass?” “Bridge”
“What movie has the Highland Games, a Witch, and Craig Ferguson as Lord Macintosh?” “Brave”

The expected answer is a text that varies.

Every turn when the location is The Round2 (this is the pub2 rule):
choose a random row in the table of round two questions;
now current question is the Qn2 entry;
now expected answer is the correct2 entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub2 answer rule):
if the current answer is the expected answer:
if the table of quiz questions is not empty:
increase score by 10;
say “Well done. Next question.”;
exit;
otherwise:
say “That was the end of Round Two.”;
increase score by 5;
move the player to The Round2;
otherwise:
say “Incorrect. Next question.”;
exit[/code]

So, the other day I got this working but wasn’t able to post here on intfiction. The discussion has moved on a bit so I don’t know what your current issue is caused by, but this version works:

[spoiler][code]“Quiz Night” by Michael Callaghan

Include questions by Michael Callaghan.
Use scoring

The Round1 is a room. "Welcome to Trivia, I’m your host, the disembodied voice coming from your device. We have only one rule; please don’t cheat. "

After looking for the first time:
follow the pub1 rule.

Table of quiz questions
Qn Correct
“According to the Old Testament, who spent 3 days and nights in the belly of a whale?” “Jonah”
“The Tom Green Show and 16 and Pregnant were originally aired on what network?” “MTV”
“The Soul and The Optima are both models by what auto make?” “Kia”
“Kim Jong Il, Joseph Stalin, or Mao Tsedong, which dictator ruled the longest?” “Mao Tsedong”

The expected answer is a text that varies.

Every turn when the location is The Round1 (this is the pub1 rule):
choose a random row in the table of quiz questions;
now current question is the Qn entry;
now expected answer is the correct entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub answer rule):
if the location of the player is Round1:
if the current answer is the expected answer:
if the table of quiz questions is not empty:
increase score by 5;
say “Well done. Next question.”;
exit;
otherwise:
say “That was Round One, now onto Round Two!”;
increase score by 5;
move the player to The Round2;
exit;
follow the pub2 rule;
otherwise:
if the table of quiz questions is not empty:
say “Incorrect. Next question.”;
exit;
otherwise:
say “That was Round One, now onto Round Two!”;
move the player to The Round2;
exit;
follow the pub2 rule.

The Round2 is a room. “Now onto Round Two where the questions get slightly harder but are worth ten points a piece.”

Table of quiz questions2
Qn2 Correct2
"Get a Mac was an ad slogan for what company from 2006 to 2009? " “Apple”
“What is the capital of Egypt?” “Cairo”
“In the contract version of what card game are players identified by points on the compass?” “Bridge”
“What movie has the Highland Games, a Witch, and Craig Ferguson as Lord Macintosh?” “Brave”

The expected answer is a text that varies.

Every turn when the location is The Round2 (this is the pub2 rule):
choose a random row in the table of quiz questions2;
now current question is the Qn2 entry;
now expected answer is the correct2 entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub2 answer rule):
if the location of the player is Round2:
if the current answer is the expected answer:
if the table of quiz questions2 is not empty:
increase score by 10;
say “Well done. Next question.”;
exit;
otherwise:
say “Well done. That was the end of Round Two.”;
increase score by 10;
move the player to The End;
otherwise:
if the table of quiz questions2 is not empty:
say “Incorrect. Next question.”;
exit;
otherwise:
say “Incorrect. That was the end of Round Two.”;
move the player to The End;
exit.

The End is a room. “Final Score: [score]/60”.[/code][/spoiler]

Most of the trouble was it was trying to apply rules for round 1 during round 2 as you hadn’t specified under what situation the text question rules should apply. Also, there wasn’t correct handling for when the player fails the last question of the round.

Just wanted you to know you’re the greatest, Joey! Absolute legend.

I now have this: [spoiler][code]“Quiz Night” by Michael Callaghan

Include questions by Michael Callaghan.
Use scoring

The Round1 is a room. "Welcome to Trivia, I’m your host, the disembodied voice coming from your device. We have only one rule; please don’t cheat. Questions will be simple this round being worth five points a piece, but will increase in both difficulty and value as the game goes on. "

After looking for the first time:
follow the pub1 rule.

Table of quiz questions
Qn Correct
“According to the Old Testament, who spent 3 days and nights in the belly of a whale?” “Jonah”
“The Tom Green Show and 16 and Pregnant were originally aired on what network?” “MTV”
“The Soul and The Optima are both models by what auto make?” “Kia”
“Kim Jong Il, Joseph Stalin, or Mao Tsedong, which dictator ruled the longest?” “Mao Tsedong”

The expected answer is a text that varies.

Every turn when the location is The Round1 (this is the pub1 rule):
choose a random row in the table of quiz questions;
now current question is the Qn entry;
now expected answer is the correct entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub answer rule):
if the location of the player is Round1:
if the current answer is the expected answer:
if the table of quiz questions is not empty:
increase score by 5;
say “Well done. Next question.”;
exit;
otherwise:
say “That was Round One, now onto Round Two!”;
increase score by 5;
move the player to The Round2;
exit;
follow the pub2 rule;
otherwise:
if the table of quiz questions is not empty:
say “Incorrect. Next question.”;
exit;
otherwise:
say “That was Round One, now onto Round Two!”;
move the player to The Round2;
exit;
follow the pub2 rule.

The Round2 is a room. “Now onto Round Two where the questions get slightly harder but are worth ten points a piece.”

Table of quiz questions2
Qn2 Correct2
"Get a Mac was an ad slogan for what company from 2006 to 2009? " “Apple”
“What is the capital of Egypt?” “Cairo”
“In the contract version of what card game are players identified by points on the compass?” “Bridge”
“What movie has the Highland Games, a Witch, and Craig Ferguson as Lord Macintosh?” “Brave”

The expected answer is a text that varies.

Every turn when the location is The Round2 (this is the pub2 rule):
choose a random row in the table of quiz questions2;
now current question is the Qn2 entry;
now expected answer is the correct2 entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub2 answer rule):
if the location of the player is Round2:
if the current answer is the expected answer:
if the table of quiz questions2 is not empty:
increase score by 10;
say “Well done. Next question.”;
exit;
otherwise:
say “That was Round Two, now onto Round Three where things get a bit more difficult!”;
increase score by 10;
move the player to The Round3;
exit;
follow the pub3 rule;
otherwise:
if the table of quiz questions is not empty:
say “Incorrect. Next question.”;
exit;
otherwise:
say “That was Round Two, now onto Round Three!”;
move the player to The Round3;
exit;
follow the pub3 rule.

The Round3 is a room. “Round Three is here! The questions are harder but now worth fifteen points a piece.”

Table of quiz questions3
Qn3 Correct3
“In 1908, what Ford Model was first produced, eventually being named the Car of the Century?” “Model T”
“The Original Ritz Hotel is located in what European City?” “Paris”
“Ebony and Ivory was a duet performed by Stevie Wonder and what former Beatle?” “Paul McCartney”
“In what year did Spongebob Squarepants premier on television, Wide Open Spaces by the Dixie Chicks won a Grammy, and the Sixth Sense premiered in theaters?” “1999”

The expected answer is a text that varies.

Every turn when the location is The Round3 (this is the pub3 rule):
choose a random row in the table of quiz questions3;
now current question is the Qn3 entry;
now expected answer is the correct3 entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub3 answer rule):
if the location of the player is Round3:
if the current answer is the expected answer:
if the table of quiz questions3 is not empty:
increase score by 15;
say “Well done. Next question.”;
exit;
otherwise:
say “That was Round Three, now onto Round Four!”;
increase score by 15;
move the player to The Round4;
exit;
follow the pub4 rule;
otherwise:
if the table of quiz questions is not empty:
say “Incorrect. Next question.”;
exit;
otherwise:
say “That was Round Three, now onto Round Four!”;
move the player to The Round4;
exit;
follow the pub4 rule.

The Round4 is a room. “This is it, the final round. Europe’s The Final Countdown is now playing on loop in your head and the questions are worth a whopping twenty points a piece.”

Table of quiz questions4
Qn4 Correct4
“Spteznaz is an umbrella term for special forces from what country?” “Russia”
“CVX is the stock ticker symbol for what energy giant?” “Chevron”
"What actor or actress was in X-Men the Last Stand, Inception, and Juno? " “Ellen Page”
“Double Think and Cold War are both terms created by what English Author?” “George Orwell”

The expected answer is a text that varies.

Every turn when the location is The Round4 (this is the pub4 rule):
choose a random row in the table of quiz questions4;
now current question is the Qn4 entry;
now expected answer is the correct4 entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub4 answer rule):
if the location of the player is Round4:
if the current answer is the expected answer:
if the table of quiz questions4 is not empty:
increase score by 20;
say “Well done. Next question.”;
exit;
otherwise:
say “Well done. That was the end of Round Four.”;
increase score by 20;
move the player to The End;
otherwise:
if the table of quiz questions4 is not empty:
say “Incorrect. Next question.”;
exit;
otherwise:
say “Incorrect. That was the end of Round Four.”;
move the player to The End;
exit.

The End is a room. “Final Score: [score]/200”.[/code][/spoiler]

It works but there’s one final step. I need to figure out how to WAGER points on a final question. I think just inserting a Round5 and appropriate rules is fine, I can figure that out now. The issue I’m facing is getting a system for wagering score. Any ideas or directions in which I should look? Note: I’m off to furiously search immediately after submitting this reply.

Part of this depends on how you want the interaction to work. Should the player type “Wager 30”? Or, when you get to the final question, will the game ask the player “How many points do you want to wager?” In the former case, you’d have to create a new action. But in the latter case, which seems more friendly–since they have to wager, and there’s one time they have to do it–you’d probably just want to ask a closed question in number mode.

Also, something I hadn’t mentioned, but you might want to try to do something to make sure that you accept multiple forms of the correct answer. Last time I checked the code it seemed like the answers were case sensitive; also someone who answered “Orwell” to the question and got marked wrong because it was supposed to be “George Orwell” might be annoyed.

Agreed on the case sensitivity. It ignores punctuation but I’m unsure how to address case sensitivity. Any ideas?

I think it’d be best if it just asked a question in number mode, then I can have it add or subtract that number from final score, simple enough. That’s what I just did in this bit of code following Round4:

[spoiler][code]The Round4 is a room. “This is it, the final round. Europe’s The Final Countdown is now playing on loop in your head and the questions are worth a whopping twenty points a piece.”

Table of quiz questions4
Qn4 Correct4
“Spteznaz is an umbrella term for special forces from what country?” “Russia”
“CVX is the stock ticker symbol for what energy giant?” “Chevron”
"What actor or actress was in X-Men the Last Stand, Inception, and Juno? " “Ellen Page”
“Double Think and Cold War are both terms created by what English Author?” “George Orwell”

The expected answer is a text that varies.

Every turn when the location is The Round4 (this is the pub4 rule):
choose a random row in the table of quiz questions4;
now current question is the Qn4 entry;
now expected answer is the correct4 entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub4 answer rule):
if the location of the player is Round4:
if the current answer is the expected answer:
if the table of quiz questions4 is not empty:
increase score by 20;
say “Well done. Next question.”;
exit;
otherwise:
say “Well done. That was the end of Round Four.”;
increase score by 20;
move the player to The End;
otherwise:
if the table of quiz questions4 is not empty:
say “Incorrect. Next question.”;
exit;
otherwise:
say “Incorrect. That was the end of Round Four.”;
move the player to The Final;
exit.

The Final is a room. “This is it, the final question. Wager anything between all and none of your points on this final question. The Category for the final question is Sports.”

Data is a kind of value. The data is wager. 

Bonus is a scene. Bonus begins when the location is The Final. 
Bonus ends when stage is complete. 
Stage is data that varies. 

When Bonus begins:
	now stage is betting.
	
Every turn during Bonus:
	if stage is betting: 
		now current question is "How much of your score do you want to wager on the Bonus Question?"
		ask a closed question, in number mode;

The player's wager is a number that varies. 

A number question rule (this is the gather wager rule):
	if  Bonus is happening and stage is betting:
		if the number understood is greater than [score]:
			say "You cannot wager more than your score, silly!"; 
		now the player's wager is the number understood;
		say "Alright, you have wagered [the player's wager] points. Let's do this!";
		move the player to Round5;
		exit;
		follow the pub5 rule.

The Round5 is a room. “Final bonus question for the game. Your wager will be added to or subtracted from your score. List the following NFL Franchises from oldest to newest by assigning the number 1 for oldest and 5 for the newest.”

Table of quiz questions5
Qn5 Correct5
“The Atlanta Falcons” “5”
“The Chicago Bears” “1”
“The Dallas Cowboys” “3”
“The New Orleans Saints” “4”
“The Philadelphia Eagles” “2”

The expected answer is a text that varies.

Every turn when the location is The Round5 (this is the pub5 rule):
choose a random row in the table of quiz questions5;
now current question is the Qn5 entry;
now expected answer is the correct5 entry;
blank out the whole row;
ask a closed question, in text mode.

A text question rule (this is the pub4 answer rule):
if the location of the player is Round4:
if the current answer is the expected answer:
if the table of quiz questions4 is not empty:
say “Uh huh, keep going…”;
exit;
otherwise:
say “You did it, you got the bonus correct!”;
increase score by [the player’s wager];
move the player to The End;
otherwise:
say “I’m sorry, that’s incorrect. Sadly, there is no partial credit for the bonus question”;
decrease score by [the player’s wager];
move the player to The End;
exit.

The End is a room. “That’s it for this game of trivia. I’m your device running Grue and I hope you enjoyed the game. Join me again for another game anytime you’d like. Your Final Score comes to: [score]/200”.[/code][/spoiler]

Sadly, I get this error: [spoiler]

[/spoiler]

The issue with that error is just that everything in that block of code is indented one time too many. If you’re going to have a rule (or other phrase) with multiple levels of indentation, the first line needs to start on the left margin. Just shift everything between “The Final is a room” and “The Round5 is a room” left (there’s actually a formatting command to “shift selection left,” so you can highlight it and select that) and that should go away.

There’s a couple of other errors I get when I try to compile–I think some of it comes from your having more stuff than you’ve defined here (you need to include Questions and use scoring, at least)–but one thing is that you don’t want to put “score” in brackets when it’s not in quotation marks. That just turns it into a comment, which means the compiler ignores it completely. So for instance you need

if the number understood is greater than score:

rather than

if the number understood is greater than [score]

For the case sensitivity issue, you can try:

if the current answer exactly matches the text "[expected answer]", case insensitively:

See §20.5 of Writing with Inform.