Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
Tutorial explaining how to set indefinite articles in AdventureJS. tutorial, grammar, indefinite article

Grammar:Indefinite Articles

All assets have an indefinite article. The default value for the base asset class is "a". Other common indefinite articles might be "an" or "the" if the object is unique, as in "the Singing Sword". AdventureJS defaults to "a" and doesn't automatically change to "an" - you'll need to do this manually. You can change it for individual assets or classes by setting asset.indefinite_article = "foo". For example, consider this antique chair.

MyGame.createAsset({
  class: "Chair",
  name: "antique chair",
  place: "Sitting Room",
  indefinite_article: "an",
  description:
    "It's an antique Victorian armchair carved of supple walnut and upholstered with purple embroidery.",
});

Additionally, all assets have an indefinite_name property which will always return the asset's name preceded by its indefinite article: an antique chair.

Finally, all assets have an article_name property which may return a proper name, or the name preceded by the definite article, or the name preceded by the indefinite article, depending on related settings.

(There is also a use_indefinite_article property though it's only used in a couple of places so don't get expect much of it.)

MyGame.createAsset({
  class: "Edible",
  name: "cherries",
  synonyms: ["cherry"],
  place: { in: "red bowl" },
  is: { plural: true },
  indefinite_article: "some",
  use_indefinite_article: true, // only used in a couple of places
});
> eat cherries You eat some cherries.