Template talk:TrainingTable
Use of This Template & It's Out-of-date Information Displayed to User
This template has no documentation on how to use it. In a specific animal article, let's say the Elk it is called by the "{{TrainingTable}}" line in the edit page. However there are no variables or parameters being set in the call. So, how does it accurately get its information to display? However in the Cougar page, the same line is called, yet it populates the train-ability status correctly.
Looking at the template itself, it looks like it's trying to figure out using a switch statement if the "Can Train [Insert Type of Training]" is true or false. However on the animal edit page, this isn't defined anywhere. Where is it checking this? Where is the Training type defined for the animal? A lot of these are broken, or missing. I'd like to update all of them, but unfortunately with lack of documentation on how this template is being used, its increasingly difficult to update this.
Also this template is out of date it seems. The five characteristics of training of an animal are "Tameness, Guard, Attack, Rescue, & Haul". Should I just abandon this template all together and just update all the pages manually, or should I create a new template that reflects the current state of the game.
Edit: I have gone onto my page DJRedNightGaming Profile Page and added the following code to the edit page. I have figured out through the MediaWiki - Property Declaration Help Article How to define a pages properties. So I've set the properties to all true for the Training Table, and yet it still is not showing any of the check marks next to the values. So I'm thinking that this template is now broken unfortunately. Wondering maybe if I did something wrong for it not to show up? Going to be working on this over the next few days. Would love some insight from you helpful people!
Heres the Code Snippet:
{{TrainingTable}} {{#set: Can_Train_Obedience=true}} {{#set: Can_Train_Release=true}} {{#set: Can_Train_Rescue=true}} {{#set: Can_Train_Haul=true}}
Edit 2: I have come up with a new version of this template, that hopefully will allow the Animals category to be updated for the most current version of the game. The code is listed below. I will wait a few days before pushing this template to production and taking it out of the development phase. I appreciate your input on the matter, and would like to get your feedback on the new design. A working example can be found at:
A few new properties were created while making this design: Property:Can_Train_Guard | Property:Can_Train_Attack This was needed as Obedience & Release are now changed to Guard & Attack values in-game with Obedience & Release now being deprecated.
For a more in depth tutorial or how to use the template, see User:DJRedNightGaming#Training_Template_Updates
The original TrainingTable template
Hi -- thanks for the interest in fixing up the wiki! A lot of the templates and SemanticMediaWiki logic can be pretty confusing at first glance. I've been working on cleaning it up in a few cases, but it's a slow process. Think of it this way -- the current Template:TrainingTable can be invoked in two ways:
{{TrainingTable}} {{TrainingTable|Muffalo}}
In fact, try previewing the second version (with the Muffalo param) on any page.
Using templates and SMW magic it will render the training table for the Muffalo. Nice! But where does the data for the Muffalo come from? Let's look at the exciting part of Template:TrainingTable to see:
{{#switch: {{#show: {{{1|{{PAGENAME}}}}}|?Can Train Obedience|link=none}} | true=[[File:check.png|24px|link=]] | false=[[File:ex.png|24px|link=]]}}
Let's add a bit of spacing to make this easier to follow:
{{#switch: {{#show: {{{ 1 | {{PAGENAME}} }}}|?Can Train Obedience|link=none}} | true=[[File:check.png|24px|link=]] | false=[[File:ex.png|24px|link=]] }}
The 2nd line here is where the magic happens. {{{ 1 | {{PAGENAME}} }}}
will look up the first parameter to the template if it was provided. If no parameter was provided, it'll use {{PAGENAME}}
. This means that if you type {{TrainingTable}}
on the Muffalo page it's equivalent to typing {{TrainingTable|Muffalo}}
OK, so that means on the Muffalo page this is equivalent to:
{{#switch: {{#show: Muffalo|?Can Train Obedience|link=none}} | true=[[File:check.png|24px|link=]] | false=[[File:ex.png|24px|link=]] }}
This is an SMW query to look up the "Can Train Obedience" property of Muffalo. See here for more details on SMW queries.
The "Can Train Obedience" property for Muffalo is set in the monster Template:Infobox_main. The muffalo page sets trainable = simple
as a parameter to Template:Infobox_main, and it sets the appropriate properties in response.
You can see all the pages which have these properties set at Property:Can_Train_Haul, for example. The TrainingTable for elk broke when you made this change. When you changed the param to "Intermediate" instead of "intermediate" the switch statement in the Template:Infobox_main broke, since it didn't recognize the capitalized version.
It's a pretty overengineered solution, but it keeps the lights on I suppose :). Does this make sense?
FixSomeBugs (talk) 05:44, 26 April 2020 (UTC)