Template:ItemX

From Star Trek Timelines Wiki
Jump to navigation Jump to search
  • x1 [[{{{1}}}]]
      Missing recipe data template. [Add]

  • [edit recipe]
    • Nothing
    [edit recipe] [edit recipe]

    Usage


    ItemX is an extension of Template:Item for consolidating the display recipes of crafted items and their parts on one page. It and its helper templates are built to make converting Item templates as easy as possible given limitations in the MediaWiki language.

    Most of the time you should not need to interact with this template directly, so before reading further, you should be sure to read the Quick Start Guide located at Template:ItemX/init.

    For best results, all ItemX data templates should be generated using the "[Add]" link automatically generated by ItemX/init. Nonetheless, this documentation is provided just in case there is a mis-entered or otherwise misbehaving data template that needs repairing (though most misbehaving tags can be repaired by simply replacing {{ItemX| with {{subst:ItemX/add| tags).

    This template takes 4 inputs:

    {{{1}}} Item Page Name
    {{{2}}} Named rarity or star count (basic or 0; common or 1; etc.). If omitted, it currently treats it as a classless item (not the same as basic; think ship schematics)
    {{{3}}} Quantity required for recipe OR the magic word recipeonly (suppresses output of top item). If omitted, defaults to 1
    {{{4}}} A {{transclusion}} tag of the data template for the named item at that rarity ({{ItemX/[item name]/[star rarity]}})

    Note, even though this template has all the information needed to produce the tag, it cannot actually create one itself due over-protective MediaWiki policies against processing multiple open instances of the same template simultaneously (looping).

    Since the nature of the job requires many instances of the same template, the only solution is to feed it a tag as an input (the compiler fully processes tags given as input before processing the outer tag). This template must be a Ferengi–it is obsessed with acquiring items and requires pre-chewed input!

    To spare users from needing to type each item's name and rarity twice, Template:ItemX/add has been provided (though that template can be eliminated if the Scribunto extension were installed on this wiki build, but until then...)


    Info


    [e] Provides an edit link for the component in the recipe. This only appears if a recipe data template exists (even if blank)

    Item also available as a standard mission reward

    This icon may appear below the [e] link of the associated item for items that can be both crafted and rewarded from a mission. Hovering your pointer over the icon will display whether the item is available as a standard or only as a rare (1-time) reward.

    Troubleshooting


    Expansion Depth


    If ItemX looks off (i.e. an item loses color or if table looks completely broken), it is possible that the item's complexity exceeds the template expansion depth limits set on this server.

    To verify if an item has exceeded its expansion depth, look at the item page in edit mode and check if you see the line "Page has exceeded the expansion depth" near the top of the page as shown below:

    Remember that this is only a preview. Your changes have not yet been saved! → Go to editing area

    Page exceeded the expansion depth


    The following are workarounds for this issue (try from top to bottom):

    1) Find the most expanded craftable components of the item (e.g. for Legendary Uhura's Earpiece ★★★★★, the two most expanded craftables are Basic Klingonese Dictionary and Basic Exo-Linguistic Text) and go to their respective ItemX data templates. For each of the {{ItemX|...}} tags, remove the 4th parameter (which should be a template tag for an uncraftable item; uncraftables have empty pages, so there is no need to expand nothing). Obviously only do this for items which is crafted only from uncraftable components.
    2) If the previous step was not enough to dismiss the warning, on the most expanded craftable items, insert subst: in front of each {{ItemX|...}}. This imports code from ItemX directly into the data template itself, bypassing ItemX. One drawback to this approach is that future updates to ItemX will not automatically carry over to this item; please post a note on this template talk page if you do this so that we know which data templates will need to be manually updated.
    3) If modifying the most expanded craftables is not enough to dismiss the warning, you can reduce the expansion from the opposite end by using {{subst:ItemX/init}} on the item page instead of the usual subst-less version. This will reduce expansion depth slightly as well.
    4) If still having expansion depth problem, please forward the issue to the talk page.

    Wrong Recipe


    Working on one item but seeing the recipe for something else entirely? You are probably just passing the wrong template as the 4th parameter (which may happen if you attempt to modify a recipe after saving).

    To ensure proper formatting, just replace all {{ItemX| with {{subst:ItemX/add| and save. The subst:ItemX/add template should fix it automatically.

    Mobile view


    The expansions and edit links are disabled in mobile view. This behavior is intentional due to lack of support for the mw-collapsible class in mobile view. If you need to see the recipe, you can switch to desktop mode by clicking here.

    Recipe not updating


    Is a change you made in a recipe not showing up on the item page? Just add ?action=purge to the end of the item page's url like so:

    http://startrektimelineswiki.com/wiki/Starfleet_Medicine_Uniform_(TNG)?action=purge

    Tools


    Here are some javascript-based tools.

    Note that some browsers will remove the javascript: prefix when you paste the code (a safety feature to protect you against accidentally loading malicious scripts but also blocks good scripts). You may have to manually type in the javascript prefix for it to work. (A trick would be top copy everything but the first j–that is avascript:importScript.... Then type a j in the address bar and then paste the rest. Or just make a bookmarklet and you can run the script on click). Both of the above methods work on most major browsers except Firefox, which users will have to open the Console by pressing CTRL+SHIFT+K and pasting the script into the input at the bottom of the console.

    expandAll.js


    Want to see a full recipe without clicking? Just copy the the following script into the address bar of your browser:

    javascript:importScript('User:CodeHydro/expandAll.js');


    enhancedItemX.js


    Recipe contains the same item over and over again in many spots? Here's a script that will add everything up for you:

    javascript:importScript('User:CodeHydro/enhancedItemX.js');

    After you execute that script, the total amount needed for the recipe will appear next to the item. For example, with a Legendary Uhura's Earpiece ★★★★★ you may see:

  • x2-45 Basic Translation Algorithm[e]
  • Meaning 2 are needed to craft one of the item directly above and a total of 45 are needed for the entire recipe. If you hover your mouse over the item (anywhere but over the link), you will also see a tooltip which shows the subtotal for that branch only (may not work on mobile screens even in desktop view). Of course totals may be off if there are any ingredients say "Missing recipe data template".

    See Also