Template talk:Dye color name

From Guild Wars 2 Wiki
Jump to navigationJump to search

Easier code[edit]

Please don't write such complicated template, the following one-liner does the job:

{{#arraymap: {{{1|}}}|,|@@@|{{#ask: [[Has color id::@@@]]}}|,\s}}

Also please don't abuse the property Has canonical name, by design this property should never be directly linked at all. Here it only works because dyes don't have page name suffix. If you want a link and a displayed canonical name you can use

{{#ask: [[Has color id::{{{1|}}}]]|format=plainlist|template=cname}}

which unfortunately has two layers of SMW queries (those a custom result format with the property printout Has canonical name would be appreciated). Note that this is not required here. --Tolkyria (talk) 22:54, 9 January 2023 (UTC)

Thanks for your suggestion. I still learning and not good to write code for SMW thing. -- Wong8888 (talk) 07:24, 10 January 2023 (UTC)
Such small templates are the best way to get into touch with SMW. While your code would have worked in the closed setting of dyes (with unique names and a limited amount of four dye slots), as soon as leave this context you would have run into problems. So I thought the earlier you get to know it the better. If you have any questions why something works and something don't, feel free to ask.
Furthermore: frankly speaking, anything that's not in <noinclude> tags will be transcluded by the wiki. This means that anything between the <includeonly> and <noinclude> will be also included, like your line break which you already fixed. These are some minor details that are sometimes hard to detect but can cause some troubles in mainspace. --Tolkyria (talk) 09:07, 10 January 2023 (UTC)
Thanks again for help and explanation. -- Wong8888 (talk) 09:47, 10 January 2023 (UTC)