Hi Harakoni, I spent some time creating the templates Template:Trading Value Table and Template:Trading Value Table Row. You can see it in action here: User:Ickputzdirwech/Steel. I've never done something like this before, so it was quite some work to build it from the ground up, but I am now fairly satisfied with the result. I started because I wanted to know which items I should craft and sell to traders (hence the name of the template) but I quickly realized that I created an extended version for Template:Ingredient List. Now I would be happy to get some feedback. What do you think? Is it suitable for the normal pages? Are there any ways to improve it? Also it takes about 30 seconds to load a page that refers to the template. How can I improve it? Or is it just because it is in the user name space?
Topic on User talk:Harakoni
Jump to navigation
Jump to search
Reply to "Extension for Template:Ingredient List"
First: the delay is due to the number of template calls and expressions you're performing. You can improve it - for example, right now you're running every single stuffable item through your create row test. 126 items is going to take up a fair amount of processor time even if its only running through that small section. Ideally you'd limit your initial ask to only things with the relevant tag. For example, if it were attempting to find things that use wood as their stuff {{#ask: [[Stuff Tags::~*Woody*]] }} would return only things with Woody somewhere in the stuff tags, and you'd thus not have to sort through every stuffable item - you'd only get ones with the woody in the first place.
You can also define variables instead of repeating use of Template:Q or just pull them straight from the ask instead like you already do with ?Name and ?Type but I'm not sure how much of a difference that'd make. I'd have to go through your specific code structure.
As it is, its definitely useful but I personally would have put on a dedicated page for trade good production where 1) you only have to explain the specific limitations in the calculation once 2) where you can make direct comparisons with other materials and their profitability 3) where the processing time impact is the lowest 4) you can cut out the unsellables and trim down the table size/processing time without a care. But we could totally put it in a collapsible and replace ingredients list, especially if we can improve the time issue. It does pretty much the same job.
I was looking for something like {{#ask: [[Stuff Tags::~*Woody*]] }} for ages. Thanks a lot! I will definitely use it. I also tried to reduce the Template:Q calls already but I will try to minimize them even further. I also noticed that it sometimes loads way faster. Could it be that it caches a lot of stuff and only evaluates the whole thing if the page or template got edited?
The issue with creating an extra page for the tables is that the template has to be on a page with PAGENAME or SUBPAGENAME of the material. Reason being, I need the name of the material in Template:Trading Value Table Row and I couldn't find a way to pass it through the #ask function, so I just access SUBPAGENAME instead. If you know how this is possible I would be very grateful.
You are of course right that the table is not that self explanatory right now. I will try to make it more comprehensible and then we can decide where to put it.
Haha should have added nowiki tags on that I think. But if get what you meant. Glad I could help
Also remember that the page is given the vars you define, not the templates. If you vardefine name as wood, and then call a template that looks for a var called name it will find it, even if it's not in the template itself.
I'm other words you can define a var in trading value table and call it in trading table row so long as when the templates are assembled the definition comes first. I.e. definite it before the ask
Also I suggest having an override for the page name now that you know you can pass it through the templates without having to check the subpagename again.
Not only does it allow you to put different versions of the table on the same page, you can put an example in your template doc and it makes testing a lot easier.
Just something like {{#vardefine:name | {{{ 1 | {{PAGENAME}}}}} }}
Oups, added the nowiki tags. :D
The simplest solution didn't came to mind. Always nice to learn something new. This allowed me to simplify the code quite a bit and it's now possible to put the table on any page you want. Thanks again for all the advice!
Hey :) After a long time I fixed a the last few issues I could find the other day. What do you think? Is it ready for rollout? Since Template:Ingredient List is collapsed I tried to do this as well, which was quite difficult since the table kept loosing its color if I made it directly collapsible. You can see my solution on User:Ickputzdirwech/Wood#Table.