Template talk:Perk Tree

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

Obscure Template Shenanigans[edit]

I wanted to explain one oddity/problem with this template: parameters passed to Perk Tree can not be passed to Template:Image Mark. For example, the following call will not work the way most editors would expect:

{{Perk Tree|width=500|perks={{Image Mark|...}}}}

It will change the image width to 500, but the marks will all be in the wrong place because Image Mark still thinks that the width is 240. Similarly, the Perk Tree template cannot be used to set default values for the mark, the mark size, the background color, etc.

The problem is the exact way that the templates get called. Before Perk Tree can be called, all of its parameters need to be expanded. Which means that Image Mark is called before Perk Tree, and it gets called in the context of the main article. What gets passed into Perk Tree is a fully-expanded argument (|perks=<div>...</div>). I think it's a nifty trick -- thanks to the wikipedians who wrote the Location Map templates. It means the Image Mark template calls can be infinitely complex, without any negative implications for Perk Tree.

The only way I can think of to give Perk Tree control over the Image Mark template calls is to have Perk Tree explicitly make the Image Mark calls. However, that means the template would look like:

{{Perk Tree
|x1=100
|y1=100
|label1=Perk Name
|x2=200
|y2=200
|label2=Second Perk
}}

Personally I think this approach is far less elegant, and probably more difficult for editors to use. Especially given that there are at least a dozen different parameters that could be passed into each individual Image Mark call, and maybe as many as 20 perks for a given tree. Even #splitargs doesn't really help too much, since there are so many optional parameters.

So what I've being doing instead is setting parameters that apply to the entire tree image before the first template call, for example:

{{#define:width|500}}{{Perk Tree|perks={{Image Mark|...}}}}

It might not be wikipedia-style, but then again wikipedia doesn't have some of the template tools that we do ;)

But if anyone can think of another good way of handling this, I'm open to alternatives. --NepheleTalk 03:44, 6 November 2011 (UTC)

New way of handling the problem: Template:Perk Tree Setup, which uses {{#return}}. (Meaning parameters in Perk Tree Setup are copied to the main article. Perk Tree and Image Mark then use {{#inherit}} to copy the parameters they need from the main article). For editors, the recommended template calls are therefore:
{{Perk Tree Setup|width=500}}{{Perk Tree|perks={{Image Mark|...}}}}
--NepheleTalk 16:26, 6 November 2011 (UTC)

Strategy for image marking templates[edit]

I redirected {{Map Markers}} to here for now, since this template already does all the required things. Do we want to factor out the generally useful image marking bits (using them in both templates), copy/paste this template or just leave it at the redirect? --Alfwyn 14:42, 16 February 2012 (UTC)

Being pointed here to use this for a map, it takes a bit to adapt it to maps honestly... I actually had to cheat and check out the Riften page to figure how to load a seperate file specifically. Also though, what on earth is the X/Y coords in? It sure as hell ain't px heh.D521talk 08:03, 6 August 2012 (UTC)
I've actually figured a lot of this template out by now - if anyone needs help with getting it to work, getting the coords for it, or whatever - feel free to give me a hollar Whispendtalk 05:44, 14 August 2012 (UTC)