Asking Questions With Options

I want to give player a choice , a question really, with 2 options and move them to room based on there anwser.

i.e journalist or police officer

EDIT: well i got it work but had to do it when game starts. can i be done after game is going, lets say at a job fair an a npc give you a choice?

One option (which I personally have not used) is the Questions extension.

Other posters here I know have used it with success.

Thank you. I installed that extension… way over my head :sob:

Unfortunately, asking questions is a painful topic. I would suggest running the Open Sesame example in the extension and then editing that to do what you want.

thank you

Questions and Hybrid Choices are the main options for this, yeah. If you want something simpler, “if the player consents” is built into core Inform and much easier to use, but it requires your questions to be phrased as yes/no.

thank you just lets me knowhow smart i truly am :grin:

can a yes/no be done with npc? is it easy.

You can use “if the player consents” any time you want.

Before jumping in the Playground:
    say "Are you sure you really want to do this? Playgrounds are dangerous places.";
    unless the player consents, stop the action.

It’s very convenient.

2 Likes

Thank you very much.

Does if the player consents automatically set up a “Please type yes or no >” prompt? Is it exclusive, or can you input a different action to cancel?

It doesn’t print anything by default; you have to do that before calling the phrase. If you enter anything except “yes” or “no” (or “y” or “n”), it says “please enter yes or no” and repeats until you choose one or the other.

It’s a “blocking” phrase, meaning the code around it doesn’t continue executing until it’s gotten a response from the player, so it’s important that you not be able to enter anything else—if you could start a new action there, the code would get horribly tangled up!

1 Like