Hybrid Choices

version 7 by AW Freyr

  • Home page
  • Beginning
  • Previous
  • Next



  • Section: CYOA Parser
    Hybrid Choices allows for a pretty flexible parser. By default, it allows players to make a choice, use the various testing functions (not in final release, of course), basic commands like looking and taking inventory, and the system commands like save, quit, restore, etc. However, you might want to implement new commands in CYOA mode, for example, examining.
    *:
        After reading a command when in cyoa mode (this is the accept examining in CYOA rule):
            if the player's command includes "x/examine", now the command accepted is true.
    This will allow examining to happen in CYOA mode.
    *:
        After reading a command when in cyoa mode (this is the accept examining in CYOA rule):
            if the player's command includes "xyzzy", now the command accepted is true.
    This will allow the player to type in "XYZZY", so you can code some sort of action in response to it.
    Unless you set the "command accepted" to true in your own parser rules, they will automatically be rejected in CYOA mode. By default, the error message that's printed is "That command isn't available in choice mode." but you can change it to whatever you want.
        The CYOA error message is "You did wrong, bub."
    The reason a text variable is used rather than a response message is simple, sometimes inconsistent error messages can give a clue, say, when the player has to type a password in a certain room.
        > ABCCB
        
        That command isn't available in choice mode.
        
        > XYZZY
        
        That command isn't available in CYOA mode.
    Use of a text variable ensures consistency in error messages, and avoids giving unintentional clues.
        Instead of xyzzying:
            if the player is not in the colossal cave:
                say "[cyoa error message][paragraph break]";
            else:
                say "Yeah the cute IF reference works."