User blog:Adnoam/Item lists

For a long time, I've wanted to see if there's some way to automatically create the items lists one might find in Category:Hat, or in Persuasive Items.

Please read, and try this out in a sandbox. Comments are more than welcome.

(tagging some of the more active wiki editors: Rahv7, Mikey thinkin, Zen Rider)

Background: How it Works Today
The way it works today, is that whenever there'a s new item in the game, besides creating for it a new Item page (with the Item template), the following steps are needed: - For each of the effects of the item, go to the relevant effect's "Items" page. - In the relevant section ("Hat", "Boots", etc.), insert a new line for the item, listing all it's effects in parenthesis, remembering to re-order so that the current page's quality is at the start of the list). Also make sure to place this new line in the proper place in the list of already existing items (sorted by level of effect). - Remember to add qualifiers to the item line (e.g. FATE, Holiday marker, etc.) - Repeat for the other effects, remembering to reorder the effect list in the item line.

Needless to say, this is cumbersome and error-prone. Also, most casual wiki editors don't know about this, and just create the Item page itself.

The Goal
So, I wanted to try and find a way to automate this process as much as possible. The idea was to write the item's qualities/effects/etc. in just one place, and by some magic have the other places updated properly.

This can't be done with just Templates. But it can be done with Modules. This is the approach which is used today by the "IL" template and module - there's one place with a list of all images linked to some name, and them the IL template, invokes the module which extracts the proper image file name.

So my approach was: like the table used by "IL", create some table(s) which contain the items' qualities and effects, and have a Module which parses it, sorts the list appropriately, and formats it for display. Of course, the Module is much more complex than the one used by IL (which just retrieves a value), and I had to teach myself Lua for this, but that part was fun.

What's Next?
For now, I've populated the tables for Hats and for Boots. If the general approach is accepted by others, we can work to build up the other classes of items. I didn't want to invest too much effort on this if the idea is rejected by others. Please take a look at these tables, and let me know if the format makes sense (and especially, if this is something you feel will be easy to update when new items are added).

If people like this approach, I'll add more documentation to the Modules and Tables to make everything much clearer.

Pros

 * For a new item, just go to the proper table and update it (like we do with a new image) once.
 * The item will automatically appear in all relevant effect lists and equippable-class lists
 * The added item lines will be properly sorted for each page and with a consistent display style.

Cons

 * Updating the tables needs to be done carefully, as it's easy to mess up the Lua table syntax by mistake. Of course, copy/paste from other item lines is best.

How to Use This
I've created this Module for now in a sandbox, for testing and for review. Modules are not intended to be invoked directly from a wiki page, but via wrapping templates (like for "IL"). So I've created a sandbox template for demonstration purposes: User:Adnoam/Sandbox/Template.

This template accepts the following parameters:
 * Class = the type of equippable item (only "Hat" and "Boots" are currently supported).
 * Quality = the desired quality (e.g. "Persuasive", "Bizarre", or even "Scandal").
 * Title = optional parameter. If specified, will create a title section before the list.

=Examples=