Year of the Dragon: Through May 28th, claim free Expansion Pack (excluding Vecna Unleashed) or a Greater Elixir of Discovery! Speak to Xatheral in the Hall of Heroes.
Known Issue: Xatheral has been temporarily disabled while we investigate a bug with Year of the Dragon gift delivery.DDO Forums edit

Game mechanicsNewbie guideIn developmentDDO StoreSocial Media


ChallengesClassesCollectablesCraftingEnhancementsEpic DestiniesFavorFeats

GlossaryItemsMapsMonstersPlacesQuestsRacesReincarnationSkillsSpells


Please create an account or log in to build a reputation and unlock more editing privileges, and then visit DDO wiki's IRC Chat/Discord if you need any help!

Template:DPL category sum

From DDO wiki
Jump to navigation Jump to search

Usage[edit]

Sums numbers collected from pages in categories using DPL and {{Add}}.

{{DPL category sum
  | category =
  | andcategory =
  | andcategory2 =
  | notcategory =
  | template =
  | attribute =
  | num_template =
  | phantom =
  | addprefix =
  | suppresserrors =
}}
  • category is a list of categories to select pages from, separated with the character ¦.
  • andcategory/andcategory2 is an optional list of categories that the pages selected should also be part of. Separated with the character ¦.
  • notcategory is an optional list of categories that the selected pages should not belong to, separated with the character ¦.
  • template is the name of the template used in the selected pages with the template's namespace. For example, "Template:Quest"
  • attribute is the name of the attribute that should be selected from the template.
  • num_template is the name of the template that can translate the output of |template= or |attribute= or |phantom= to a numerical value.
  • phantom is the name of a phantom template that will take the original parameters of the |template= and output a different result.
  • addprefix The {{Add}} template takes a prefix (by default, this prefix is "x"). This prefix in turn controls the name of the variable holding the sum result (which by default is {{#var: sumx}}). Providing a different |addprefix= will change the variable's name. Make sure that the |addprefix= is not a prefix of "prefix" or "template" (as described on {{Add}}'s documentation).
  • suppresserrors If this parameter is not empty, then any erroneous values will be treated as zeroes instead of throwing an error.

Notes: |category= and |template= are mandatory. However, for the sum to work, the final output should be a numerical value. Initially, we have the result of |template=. If this is not what we want, we can either take an attribute passed to it, or designate a phantom template to create a different result. If this is still not what we want, we can provide a |num_template= to translate the output of |attribute= or |phantom= to a numerical value.

Examples[edit]

  • Give |category= |template= and |attribute= to sum the specific attribute/parameter of a template from all the pages in one category.

Example: {{DPL category sum|category=The Twelve patron quests|template=Template:Quest|attribute=favor |suppresserrors=y}}

219
  • You can also count attributes that are not numbers by providing a template in |num_template= that will convert text to number.

Example: {{DPL category sum |category=The Twelve patron quests |template=Template:Quest |attribute=free |num_template=IO}}

29
  • You can use a phantom template to produce numbers based on more complex calculations that involve more than one of the initial template parameters. The phantom template provided in the parameter |phantom= should have a number as a result. The parameter |attribute= does not have an effect if |phantom= is given.

Example: {{DPL category sum |category=The Coin Lords patron quests |template=Template:Quest |phantom=Max quest favor |suppresserrors=y}}

702
  • Use |notcategory= to prevent pages from being in a certain category.

Example: {{DPL category sum |category=Short quests¦Long quests |notcategory= History¦Quests with no favor reward |template=Template:Quest |attribute=favor |suppresserrors=y}}

1416
  • Use |andcategory= to make pages belong to more categories.

Example: {{DPL category sum |category=Level 14 quests |andcategory=Epic quests |template=Template:Quest |attribute=epic |num_template=IO}}

11

CODE[edit]

You haven't selected a category