A HINT Command: Decoding With A Key - ThePix/QuestJS GitHub Wiki

This is one approach to giving users hints. We give the user a page with all the clues on it, but encoded; the user can decode the one she wants to see.

This style of hinting is credited to Scott Adams, and you can see it in use here.

Quest will do all the work of converting clues to numbers.

This is in an optional library, so the first step is to tell Quest to include it. Somewhere in your settings.js file add this line:

settings.libraries.push('hint-sheet')

The Data

Most of the work has been done for you - you just need to provide the data. This is an array of questions and answers, each pair being a dictionary, with entries "q" and "a". The answers should all be brief - what the player would type - and lower case. It should go in settings.js.

Here is an example.

settings.hintSheetData = [
  {q:'Stuck in the library?', a:'kill goblin'},
  {q:'Stuck at the dorm courtyard?', a:'pull the torch'},
  {q:'Bothered by the witch?', a:'wear the pearl necklace'},
  {q:'Unable to open the trapdoor?', a:'burn the rag then get the spider'},
]

I think this works best if you have at least a dozen questions so answers cannot be guessed at random. You could consider adding red herrings too - clues to things that are not in the game at all will help to obfuscate the real clues. You might want to warn the player.

Customising

This is optional, but you might want to customise the page title and the introductory text. This should be in code.js.

lang.hintSheet = 'Hint Sheet'
lang.hintSheetIntro = "To use this hint sheet, start to read through the list of questions to see if there is one dealing with the place where you're stuck in the game. To decode a hint, substitute the numbers in the hint for the numbered words in the 'dictionary' at the bottom of the hint sheet. <i>To get back to your game, just go to its tab.</i>"