-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command failure customization suggestion #87
Comments
Omikhleia
added a commit
to Omikhleia/room.js
that referenced
this issue
Aug 18, 2016
- For the former, supports singularizers ('any', 'a', 'an' and ordinal rank). The 'all' globalizer is parsed, but currently object matching logic still returns 'ambiguous' as before. - For the latter, working simplest hook solution at this stage, without much refactoring. - DOC and DEMO updated accordingly
Omikhleia
added a commit
to Omikhleia/room.js
that referenced
this issue
Sep 4, 2016
- For the former, supports singularizers ('any', 'a', 'an' and ordinal rank). The 'all' globalizer is parsed, but currently object matching logic still returns 'ambiguous' as before. - For the latter, working simplest hook solution at this stage, without much refactoring. - DOC and DEMO updated accordingly
You've partially solved this, but I agree with your second point at the end. I'd like to try and move more of the player command parsing completely into the game world, rather than have the engine be solely responsible for it. Let's leave this issue open a little longer as a reminder... |
closing in favor of #144 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It came to my notice that the "I didn't understand that." message when a command failed is located in player-controller.js (where all command processing is currently done).
It is thus the only "in-game" message (excepting internal errors, that's obvious and ok) that cannot be customized.
There's however more that could be done, depending on the user input, e.g. checking if objects were matched despite no verb being found, or checking if an ambiguous result was met, for suggesting help, etc.
I have first considered adding a onPlayerCommandFailed() hook on the 'system' object, with the current "hard-coded" message being used only if the hook doesn't exist. This does work on my testing code base, allowing for more precise messages and game-specific decision on what to do, so it's pretty cool, IMHO.
Nevertheless, I wonder whether a yet better approach / a step further woudn't be to also have the whole verb execution logic from player-controller.js moved to world-object-proxy-builder.js.
It would thus be exposed to the in-game context (after all, as are, already the matchObjects() and matchVerb() methods).
Two example use cases for this:
To achieve this so far in my world demo/testing code, in both cases I've just ended up replicating almost(*) exactly what player-controller.js does in its runCommand() method, so there could be an interest having the whole verb execution logic available for use in-game.
(*) "almost" : the command dispatching for the NPC doesn't test for verbMissing, obviously, or there could be an infinite loop.
The text was updated successfully, but these errors were encountered: