How to detect a noob player and give them help

Hi guys,

I’m using the “Y ask Y?” recipe book example to detect when the player doesn’t know what to do, and to give them a helping hand. Which is great. But I would much rather detect a player who doesn’t know what to do (as in how to type commands, etc).

To detect if a player needs help I have:

[code]A thing can be examined or unexamined. A thing is usually unexamined. Carry out examining something: now the noun is examined.

Taking inventory is acting confused. Looking is acting confused. Examining an examined thing is acting confused.

After acting confused for the sixth turn:
say “(If you are feeling lost, try typing [italic type]help[roman type] for suggestions.)”.[/code]

Is there a way to catch commands that the parser doesn’t understand and give them a label so I can do something similar for someone who is typing lots of random things (rather than the usual interactive fiction commands)?

You could try hooking it onto the “Printing a parser error” activity (see section 17.33 of the documentation). Something like this:

The parser error count is a number that varies. The parser error count is 0. After printing a parser error: increment the parser error count; if the parser error count is 6: say "(If you are feeling lost, try typing [italic type]help[roman type] for suggestions.)".

If you only want commands that are complete nonsense, you might want to restrict the error count to a few of the different kinds of parser error – there’s a list in 17.33. So the “not a verb I recognise error” is something that can come about when the player types something that doesn’t even look like a command, while the “can’t see any such thing error” may come about when the player types what would be a valid command, but you didn’t implement the thing they’re trying to act on.

Another thing to think about is that a simple count of parser errors might not be enough; if the player makes the sixth parser error on the 150th turn, they probably don’t need the help text. And if a player starts with five straight parser errors, they probably won’t stick around for the sixth. So you might try something like this:

The parser error count is a number that varies. The parser error count is 0. After printing a parser error when the parser error count is at least 0: increment the parser error count; if the turn count divided by the parser error count is less than three: say "(If you are feeling lost, try typing [italic type]help[roman type] for suggestions.)"; now the parser error count is -1. [This ensures that we don't keep printing the message.]

This gets the player right away if they type something invalid in the first two turns, and the more they progress the more mistakes they have to make to trigger the help text.

You might also want to look at Aaron Reed’s Smarter Parser, which gives more specific responses to a lot of common error, and which unlike anything I’ve typed above has been tested on real people. (Warning: Smarter Parser can slow the game down considerably, especially in online play, and before you use it you should look at all the messages to make sure they’re appropriate to your game. I think there’s a rule there that tells you you don’t have to refer to parts of the body, which you don’t want if you have to refer to parts of the body in your game.)

Another way would be to map unrecognized input to a special a way of acting confused. Try adding this to your code:

Being confused is an action applying to a topic. Report being confused: say "That's not a verb I recognize." Understand "[text]" as being confused. Being confused is acting confused.

This is no longer true in the latest version, which also in general has made it easier for authors to customize messages and behavior not appropriate for a particular game. :slight_smile:

Thanks guys - absolutely awesome suggestions. When I get the new player version finished I’ll look into making an extension or, at the very least, put the source code up somewhere. With credit of course. That suggestion about the ratio is awesome matt. Much better way of doing thing, and the increments seem neater too. Thanks!