Player's input

hi
i have a problem im running following code

if player's command does not match "x":
	say "foo";

almost works …it doesnt work if player’s input is not registered command. how do i make it work so whatever player types in if not x i want to say foo.

1 Like

If Inform shall only print foo, and then not try to parse the command any further, then you need to tell it to reject the player's command, like this:

After reading a command:
	if player's command does not match "x":
		say "foo[line break]";
		reject the player's command;

See also 18.33. Reading a command.

3 Likes

thank you :slight_smile:

its almost working but i have an issue after rejecting command nothing executes in rule i can do work around but is there any way to control flow? for instance

After reading a command:
	if flopyNextStep is true:
		if player's command does not match "x":
			say "bljaka";
			reject the player's command;
			Continue the action;		
		Now flopyNextStep is false;
	Continue the action.	

this will continue until i pres x regardless of anything. can flow of commands be regulated somehow?

1 Like

Sorry, I hadn’t seen the later edit with the follow-up question.

Since you marked the thread as solved, you’ve probably already proceeded successfully in the meantime, and/or the discussion has moved on to the newer thread Talking to NPC, I think?

However, if the question here is still relevant, feel free to say so, of course. :slight_smile:

2 Likes

hi

yes the talking NPC is almost solved… i havent yet checked all other info provided there… but quick question… im trying to free user from convo at any time i tried this:

After reading a command:
	If command prompt is "Talking to [TalkingPartner] >":
		if player's command is not number understood:
			now command prompt is ">";
	continue the action.

and again if statment is issue …since i want to clear prompt if users input is “eat apple” but not if “6” or “six” is entered

1 Like

You can check for that by using this:

if the player's command does not match "[number]":
	now the command prompt is ">";
1 Like

thank you :slight_smile:

2 Likes