Adding Items to Tables

From HLKitWiki
Revision as of 22:57, 19 November 2008 by Rob (talk | contribs)
Jump to navigationJump to search

[Context: HL Kit … Basic Concepts and Terminology … Manipulation of Visual Elements … Working With Tables]

One of the most common mechanisms you'll be using is dynamic tables, as they allow the user to add new items to the character. Whether it be for skills, abilities, powers, spells, gear, or something else, a major part of character creation involves selecting an assortment of options from a list to customize the character. Dynamic tables are the mechanism the Kit uses to accomplish that task.

Dynamic tables are actually two tables in one. First, there is the table in which the selected items are displayed, often called the "show table", and this works as outlined previously. However, there is a second table involved, which is the means through which available items are presented to the user for selection. This is often referred to as the "choose table".

The choose table behaves very similarly to the show table. It uses the same component for filtering the list of items shown. It also uses the List tag expression to filter the items shown. The reason for this is that any item that gets added to the table must fundamentally be shown within the table, so it stands to reason that the same requirements be applied.

However, the choose table also has a separate tag expression, which is called the "candidate" tag expression. The Candidate tag expression is distinct because there are often times when you'll want to be more restrictive in deciding which items can be added to the table. It is combined with the List tag expression to yield the final list of items that are presented to the user for selection. For example, consider a table of special abilities. Many abilities will be user-selectable, while a number of them will only be added to the character as the result of another choice, such as racial abilities being automatically added only when the corresponding race is chosen. The list of abilities possessed by the character and presented in the show table must include these racial abilities, while the list of abilities that the user can freely choose from must not. To handle this distinction, two separate tag expressions are required, although the Candidate tag expression will simply be empty when no additional restrictions are needed.

In addition to the separate tag expression, the choose table also has a separate template. The list of information users want to view when choosing an item will often be different from the information they want when viewing items that have been added to the table. To accommodate this, a separate template is specified, but there is no reason that the same template cannot be used for both purposes. By decoupling templates from tables, you can readily re-use the same template in multiple places.

Another important distinction between the choose table and the show table is the nature of the items presented for selection. Every item that has been added to the character is always a pick, which means that the show table always displays an assortment of picks. However, the choose table can contain either picks or things (never a combination). The norm will be things, such as presenting a list of weapons that the user can select from. When things are chosen, a new pick is created and that pick is then added to the character. Sometimes, though, you will want to display picks that have already been added to the character. For example, the Wizard class in the d20 System must memorize spells from the spellbook. When spells are added to the spellbook, things are chosen and picks are created. However, when spells are memorized, the list of available spells is pulled from the picks that have already been added to the spellbook.



add template add item script titlebar script description script