Help! - ThePix/QuestJS GitHub Wiki

Here is a quick way to do a pretty comprehensive help system. When the player types HELP, she is presented with a list of help topics, and can select one to see the relevant help printed to screen.

First modify the command. I am using the showMenuDiag menu, but you might want to use another version.

findCmd('MetaHelp').script = function() {
  showMenuDiag('Help topic?', Object.keys(helpTopics), function(result) {
    metamsg("{b:{i:" + result + "}}")
    for (const s of helpTopics[result]) metamsg(s)
  })
  return world.SUCCESS_NO_TURNSCRIPTS
}

If you prefer the help information to appear in a dialog, rather than in the narrative, try this version:

findCmd('MetaHelp').script = function() {
  showMenuDiag('Help topic?', Object.keys(helpTopics), function(result) {
    showDiag(result, helpTopics[result].join('<br/><br/>'), 'Okay')
  })
  return world.SUCCESS_NO_TURNSCRIPTS
}

The data is just a dictionary. Each name is the menu item (and needs to be in quotes if it includes spaces).

const helpTopics = {

"Warnings": [ "There are no warning for this game.", ], "About": [ processText("{i:{show:settings:title} version {show:settings:version}} was written by {show:settings:author} using QuestJS (Quest 6) version {show:settings:questVersion}.", {settings:settings}), "With thanks to The Pixie for creating QuestJS.", ], "General Play": [ "This game is played entirely though the buttons top-right and the panels on the left.", "The buttons handle out-of-game interactions, such as this help, which you obviously found. You can also save/load, toggle dark mode and undo.", "On the left are the panels for interacting in the game world. At the top is the compass rose for moving to different locations, with an eye in the middle allowing you to look at the current location.", "The bottom three panes list items and people the player is holding, wearing and can interactive with in the room. Clicking on one will bring a list of associated options.", ], "Objectives": [ "Your main objective is to make money, and stay alive.", ], "Hints": [ 'Get to level 5 before you leave the city.', ], }

⚠️ **GitHub.com Fallback** ⚠️