Enter an answer and test it in order to unlock exit to next room

I am working on a Treasure Hunt game idea. In my game each room description will be a clue to a Streetview location. Each location maps to a room in my game. When people go to that Streetview location they will be able to see something that lets them answer the question for the corresponding room. If they get the answer right then their score increases and the exit unlocks, letting them go to the next room. If they get the answer wrong they lose points on their score (this discourages people from guessing).

For example, I am looking at a theatre wall on Streetview and I can see there is a poster for a play called "Rainbows". In the game I ask the question "What is the title of the play?".

I want the player to be able to enter "RAINBOWS" as the answer to a question that unlocks the exit to the next room.

Here is how I think I can do it, but if you have a better way then please let me know.

I create an object called "Microphone" in every location. There is an action "Speak to me" for the microphone.

When a player thinks they know the answer to the question they click "Speak to me". That action triggers a "Get input".

I've found the "Get input" verb, and I sort of understand the syntax. But how do I tell Get input the name of the variable? Do you call them variables? What I'm trying to ask is where does the text for Get input actually go? I'm just not sure.

Do I need the "Microphone" object? Is there another way to ask the player for the answer?

If this was BASIC I would say

PRINT "That's right...you can go to the next location"
UNLOCK {name of the exit}
PRINT "Wrong! Stop guessing!"

Any suggestions?


Just to add, this is what my code looks like at the moment and not surprisingly it generates a syntax error.

Shouldn't "get input" have a variable as a target? That variable also goes inside the "if" brackets.

get input {
if (. = ) {
UnlockExit (Robin to OMS)
else {
msg ("Nope! Did you read the instructions to enter the answer in UPPER CASE LETTERS (not a number)? Or maybe you just guessed? Either way you just lost a point, you plonker!")
DecreaseObjectCounter (CAMRA Goood Beer Guide 2020, "")

I create an object called "Microphone" in every location. There is an action "Speak to me" for the microphone.

This seems an odd way to do it; I'd have been more likely to have a command with the pattern answer #text# so the player can enter "answer rainbow" or whatever, rather than having to use an object.

Just idle thoughts. If that works better for you, feel free to ignore me.

Shouldn't "get input" have a variable as a target?

No. get input, ShowMenu, and Ask all put the player response into a variable named result. It's a little weird; but every language has its quirks.

Also, if you are posting code on the forums, you need to put a line of backticks (```) above and below it, so that the forum's auto-formatting doesn't wreck it. Your code seems to be missing some parts.

Hi there!

Thank you for the reply. I would never ignore sensible advice :-)

I have to admit I actually "read the manual" for the get input command and it does mention the result thing. For some reason I struggled to use the code generator to make that work, but when I just edited the code manually it worked perfectly :-)

I'm interested in your answer #text# suggestion. The only problem is that some of the folks who would use this have very basic computer skills. So I suppose I have to consider is it easier to explain to them that they have to type the word answer before the answer, or that there is this bizarre imaginary microphone they have to speak into? :-)

I do have a follow-up question. I'm trying to keep score and there are two ways I thought of doing it.

One is to have an object that they collect in the first location - in this case the CAMRA Good Beer Guide 2020. I would increment an attribute in that object as the score.

The other way is that I use a variable, Score (which would be the obvious thing to do). But I'm not sure I understand how this language uses variables. I can't see to find a way to print out the score. The command print "Your score is "+Score doesn't work and generates a syntax error.

But I'm getting there. I think this is definitely the platform I can use for the treasure hunt.


Well I'll be darned. I read the manual again and there's actually a section on keeping score! I'm pretty sure that was not there until I asked the question here ;-)

I will give that a go

This topic is now closed. Topics are closed after 60 days of inactivity.