Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
Tutorial explaining how to debug in console in AdventureJS. tutorial, debug, debugging

Debugging:Debug in Console

AdventureJS can log a firehose of information to the browser's inspector console. Logging info has been divided into categories you can individually enable to make the data flow more manageable. Below is a list of options, and an example of how to enable them in your game file. All options are disabled by default, so you only need to include the options you want to enable.

We don't do a lot of hand holding for console logging. If you're comfortable enough to open an inspector window, we're confident that you'll be able to make sense of the output. Try Parser if you're having problems of interpretation; travel if you're having problem moving from room to room; Tangible if objects aren't interacting as you expect, etc. You get the picture. All will turn on the full firehose. For illustrative purposes, we offer the full log for one turn down below.

If you're new to development and not sure what the inspector console is – it is a debugging tool that is built into your web browser and available to all web developers. On most desktop browsers you can open it with these keys: Ctrl + Shift + I (Windows, Linux) or Command + Option + I (macOS). Alternately you should be able to right-click on this page to bring up a contextual menu, and click the Inspect item. Find more instructions for these major browsers: Safari | Chrome | Firefox | Edge.

MyGame.settings.set({
  log = {

    // log all options regardless of their settings
    all: false,

    // log Character class operations
    character: false,

    // log clone, merge, diff, restore, save operations
    copyoperations: false,

    // log debug statements that otherwise print to the display
    debug: false,

    // log Dictionary class operations
    dictionary: false,

    // log Display class operations
    display: false,

    // log Exit class operations
    exit: false,

    // log Game class operations
    game: false,

    // log Parser class operations
    parser: false,

    // log anything printed to the display
    print: false,

    // log Room class operations
    room: false,

    // log SubstanceEmitter class operations
    substanceemitter: false,

    // log SubstanceMixer class operations
    substancemixer: false,

    // log Tangible class operations
    tangible: false,

    // log travel operations
    travel: false,

    // log utility operations
    utility: false,

    // log verb operations
    verb: false,

    // log when attempts are made to call verb action hooks
    verbaction: false,

    // log when attempts are made to call verb reaction hooks
    verbreaction: false,

    // log when attempts are made to call verb phase hooks
    verbphase: false,

    // log Vessel class operations
    vessel: false,
  };
});

Examples

Without going into details, we present a turn's worth of All just to give you a sense of what to expect.

L1514GameReactor.emit(inputEnter)

L1091ParserparseInput() e

L1514GameReactor.emit(inputParseBegin)

L1040CopyOperationsgetBaselineDiff() took 0.094 seconds.

L1044CopyOperationsadventurejs.worldSave > Attempting to save the world.

L1045CopyOperationsadventurejs.worldSave > Saved the world.

L1032Parsernew input created

L1560ParsersanitizeInput() receive: e

L1566ParsersplitByPeriods() receive: e

L1568ParsersplitByThens() receive: e

L1569ParsersplitByThens() return: e

L1567ParsersplitByPeriods() return: e

L1568ParsersplitByThens() receive: e

L1569ParsersplitByThens() return: e

L1092ParsersanitizeInput() return: e

L1032Parsernew input created

L1559ParserparseStrings() receive: e

L1279ParserparseStrings() return:e

L1558ParserparseNumbers() receive: e

L1536ParserparseNumbers() return:e

L1467ParserjoinCompoundPhrases() receive: e

L1110ParserjoinCompoundPhrases() return: e

L1570ParserstripArticles() receive: e

L1237ParserstripArticles() return:e

L1546ParserjoinCompoundPrepositions() receive: e

L1257ParserjoinCompoundPrepositions() return:e

L1556ParserjoinPhrasalVerbs() receive: e

L1557ParserjoinPhrasalVerbs() return:e

L1571ParserstripConjunctions() receive: e

L1513ParserstripConjunctions() return:e

L1525ParserparseVerb() receive: e

L1526ParserparseVerb() found: east

L1211ParserhandleWord() Begin parse.

L1525ParserparseVerb() receive: e

L1526ParserparseVerb() found: east

L1213Parsereast

L1252ParserqualifyParsedVerb() receive: east

L1139ParserqualifyParsedVerb() return: east

L1216Parsereast recognized as verb

L1311dictionaryDictionary.doVerb > verb: east

L1292Verbeast.do()

L1294VerbPhaseeast.doBeforeTry()

L1295Verbeast.handleActions('try')

L1498VerbdoVerbAction('tryEast')

L1476VerbActionmighty_hero.tryEast()

L1296Verbeast.doTry

L1078Traveleast

L1079Travelfound exit: standing_room_east

L1082TraveldoSuccess, travel to east_room.

L1088Print{We} walk east to the East Room.

L1059GameEast Room

L1485Tangibleremove mighty_hero from standing_room

L1456VerbReactionstanding_room.doRemoveThatFromThis(Mighty Hero)

L1038VerbActionAsset.doVerbAction() FOUND standing_room.doRemoveThatFromThis(mighty_hero)

L1088PrintElvis has moved from the Standing Room!

L1456VerbReactionmighty_hero.doRemoveThisFromThat(Standing Room)

L1038VerbActionAsset.doVerbAction() FOUND mighty_hero.doRemoveThisFromThat(standing_room)

L1088Print{We} moved from the Standing Room!

L1575Tangiblestanding_room.removeThatFromThis(Mighty Hero)

L1457Tangiblemove mighty_hero in east_room

L1456VerbReactioneast_room.doMoveThatToThis(Mighty Hero)

L1456VerbReactionmighty_hero.doMoveThisToThat(East Room)

L1038VerbActionAsset.doVerbAction() FOUND mighty_hero.doMoveThisToThat(east_room)

L1083Gameprint east_room description

L1088PrintEast Room

L1088PrintThis eastern offers a view of the Great Wall and the beginnings of thedesert.

L1088Print{We} can gowest to theStanding Room,southwest, oreast.

L1050Gameprint east_room contents

L1488Tangiblesandy_bed.getPrintableListOfContents()

L1480Tangiblesandy_bed.getPrintableListOfContentsAt("on")

L1074GamegetPrintableObjectList() receive:shovel

L1088Print{We} can see a hare, and a sandy bed here. On the sandy bed you see a shovel.

L1297VerbPhaseeast.doAfterTry()

L1298VerbPhaseeast.doBeforeSuccess()

L1299Verbeast.handleActions('do')

L1498VerbdoVerbAction('doEast')

L1476VerbActionmighty_hero.doEast()

L1300Verbeast.doSuccess()

L1301VerbPhaseeast.doAfterSuccess()

L1542GamegetStringArrayFunction called a function that returned something other thana string.

L1114ParserselectPresent() receive:annie's_boobs

L1114ParserselectPresent() receive:turtle

L1114ParserselectPresent() receive:hare

L1514GameReactor.emit(inputParseComplete)

L1002eventsEvent > inputParseComplete