A HINT Command - ThePix/QuestJS GitHub Wiki
If your game has puzzles of any sort, there is a chance the user will get stuck and might appreciate a hint. How might you create a HINT command?
There are all sorts of ways to do this. The command might note where the player is, and give an appropriate hint. You could have an attribute on the player that gets increments at each stage, and give a hint appropriate to the current stage. Both strategies are good because they only give the player a hint about the current situation, without spoilers for the future, but are difficult to implement.
Static Hints
Static hint systems do not change as the game progresses, making them much easier to implement.
Here you will find an approach that we could call "InvisiClues" - a page with all the clues on it, but hidden unless the player wants to see them.
Another way, popularised by Scott Adams, is to encode the clues, and give the user the key to decode the ones she is interested in; it is described here.
Dynamic Hints
Dynamic hints change as the player progresses through the game. For example, the player isstood before a locked door, and the user types HINT. The system realises where the user is stuck, and responds "Maybe the ogre has a key".
Dynamic systems are significantly more work because you have to think about what situation the hint is applicable, and more specifically what attributes or what objects you need to check.
Again, there is a built in system, but it can only take you so far.
How to do dynamic hints is discussion here.
Custom Message
Finally, if you do not want to implement a hint system, you might just want to have your own custom message. This would need to be in code.js.
lang.hintScript = function() {
metamsg("Sorry, no hints available.")
return world.SUCCESS_NO_TURNSCRIPTS
}