Problem-Solving Characters

version 2 by Ron Newcomb

  • Home page
  • Beginning
  • Next

  • Documentation

    Section: How to Circumvent an Obstacle
    When a character tries to unlock a door but is told, "You lack the key," the door becomes an obstacle. Or in terms of Inform-ese, a check rule on the Unlocking action called "the can't unlock without the correct key rule" is the obstacle. We can show characters how to circumvent the obstacle with:

        When hindered by the can't unlock without the correct key rule, we could try finding the matching key of the noun.

    That rule has an advantage over this:

        Before someone opening a locked door, try the actor finding the matching key of the noun.

    The Before rule would try the circumvention immediately, in the same turn. If the finding action involves travelling around the map, which incidentally requires circumventing other locked doors and many other things, well, that's a lot of action for a single turn. By contrast, the Hindered By rule saves the circumventing action for next turn, and can re-try the original action on the turn after that. If the finding action requires a lot of sub-actions to complete, the whole string of actions is remembered and re-tried, in correct order, over as many turns as necessary.
    This extension handles all the bookkeeping. The AGENDA testing command (abbreviated A) shows the outline for each character, with each action's status. One action in a character's outline may be in bold print. If so, that is the action that character will perform the next time he or she gets a turn. It can be fetched with the phrase "what (someone) will do next", and even printed to the screen as part of a THINK or HINT command. It is also the phrase used by the "every on-stage NPC gets a turn rule", found in the Every Turn rules.
        > AGENDA
            taking the potato (solved the basic accessibility rule)
                speaking with the microwave (failed)
                attacking the microwave (failed)
                opening the microwave (successful)
                dropping the microwave (moot)
            taking the potato (hindered by the hot potato rule)
                examining the potato (untried)
    If multiple actions were suggested by the When Hindered By rules, they are tried in that order, one per turn, until one of them succeeds. When one does succeed, the parent action is re-tried, and should succeed this time. If it does, the untried alternatives are rendered moot. If it fails again but because of a different check rule, it is marked partly successful, the agenda says it "solved" the old check rule, and the action is re-created in the outline as hindered by the new check rule.
    In lieu of the "we could try" phrase in response to a hinderance, we can "pretend it worked". The "already" check rules use this, like so.
        When hindered by the can't lock what's already locked rule, pretend it worked.
    Commands like BOB, PEEL POTATO use Bob's turn as well as the player's. A character is "busy" if he's working through his agenda, but if persuasion succeeds he'll pause what he's doing to serve the player. This is also part of the "every on-stage NPC gets a turn" rule.