EQ/howtohelp/Creating an item tooltip: Difference between revisions
(Created page with "== General == So I have noticed all these cool lucy tooltips on the site. How do I use them? How do they work? Well my estranged friend, Let me explain. I wrote some templ...") |
No edit summary |
||
Line 46: | Line 46: | ||
Little known fact #Lucy Parser Function actually uses the Item template. | Little known fact #Lucy Parser Function actually uses the Item template. | ||
You should use the #Lucy parser function when able because it is easier to use, and does | You should use the #Lucy parser function when able because it is easier to use, and does not require looking the item up on Lucy and figuring out its Item ID. | ||
'''What you should have learned so far''': | '''What you should have learned so far''': |
Revision as of 21:05, 25 July 2013
General
So I have noticed all these cool lucy tooltips on the site. How do I use them? How do they work? Well my estranged friend, Let me explain. I wrote some templates and custom code which figures out which item to show you based on the item name.
So all you really need to know is the item name. We use something similar to a template called a Parser Function. Basically a Parser Function is a special kind of template that occur before templates are dispalyed. (This is a lie, but just pretend that is the truth okay; this is the non-technical people guide).
Using the #Lucy Parser Function
So there is this Parser Function called #Lucy, you know it is a parser function, because it begins with #. So basically a Parser Function, is a template that begins its name with #.
What does the Parser Function, #Lucy do? All it does is translates An item name to an item ID and product the wiki code to generate an item tooltip for the named item. It does this by figuring out the Lucy Item ID.
So pick ANY ITEM IN THE GAME. Say Singing Short Sword. Or something like Greater Terrormote. Lets see the code to make those work.
* {{#Lucy: Singing Short Sword}} * {{#Lucy: Greater Terrormote}}
Copy and paste produces:
- {{#Lucy: Singing Short Sword}}
- {{#Lucy: Greater Terrormote}}
Seems to work pretty well. What happens if the Parser Function fails to look up the name? Well this can happen for a few reasons. But generally it is pretty smart about it. Contact User:Zoycite about it. However there is an alternative called the Item template. In a nutshell the Item template is used to link to arbitrary item id's and display any text you like.
What you should have learned so far:
- How to recognize a Parser Function
- How to use the #Lucy Parser Function
- There is an advanced template named Item to link to arbitrary items
Linking to items using the Item template
There is a small caveat to the #Lucy parser function. That is it may not always be accurate. Items are named the same, or otherwise it just doesn't know about. Well this is why you would use the Item template, to cure the ambiguity.
Let's use {{#Lucy: Singing Short Sword}}, as our example because it is here. It has the following information
- Item ID - 20542
- Item Name - Singing Short Sword
To generate the Item link how I want I would type:
* {{Item|Singing Short Sword|20542}} * {{Item|Bard Epic 1.0|20542}}
Does it work ?
Little known fact #Lucy Parser Function actually uses the Item template.
You should use the #Lucy parser function when able because it is easier to use, and does not require looking the item up on Lucy and figuring out its Item ID.
What you should have learned so far:
- How to link to arbitrary items changing the display name of the link
- That #Lucy uses the Item template
- Using the #Lucy parser function is easier.