Template talk:MonsterNoTile
Can I get a second set of eyes on this?
So something that I feel we should fix: there are many pages for variant monsters without tiles uploaded. I want to get the ugly redlink off the monster template for those pages, while still noting that there isn't a tile (so hopefully someone will eventually upload it). The intended behavior here is that if the tile is explicitly named, it will try to show it (and show a redlink if it doesn't exist), but if it is not explicitly named and is trying to find the tile's image file based on the page name (which is what it does for the vast majority of monsters, especially now that we're splitting the remaining multi-monster articles up), it'll display the found image only if it exists; otherwise, it'll display (No tile), which I think looks better than a redlink.
As one can see from the edit history of this page, template editing is not an area I'm too familiar with. Currently, this modified template is used on Arcadian avenger and shayateen, to test it on pages without and with uploaded tiles respectively. I've also tested, via the preview function, the behavior with explicitly named tiles, and it does appear to work. But can someone look over this modified template, to make sure I'm right that it's actually working correctly?
The eventual goal will be to introduce these modifications to the basic monster template, so that we can get the redlinks off all those pages, but of course I did not want to edit such a widely-used template without being damned sure my edits aren't going to break every page with the template. -Ion frigate (talk) 06:19, 17 June 2024 (UTC)
- Thanks. I also set it to add monsters with missing tiles to a category, so we'll have a centralized place to find them. -Ion frigate (talk) 10:06, 17 June 2024 (UTC)
So far: learning the syntax, which is not hard. Unclear on details of when things get eval'ed and re'scanned, which means i can read things, but debug them. https://nethackwiki.com/wiki/Special:ExpandTemplates helps a lot.
https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#ifexist_and_wanted_pages says the page being tested for ends up on Wanted Pages. Which is the original problem we are trying to solve!
https://en.wikipedia.org/wiki/Template:Linkless_exists looks better but we do not have it. https://en.wikipedia.org/w/index.php?title=Template:Linkless_exists&action=edit shows that the implementation is one line of code:
{{#if:{{PROTECTIONEXPIRY:edit|{{{1|}}}}}|{{{2|true}}}|{{{3|}}}}}
I suggest one of us write a Linkless_exists template, commit it, then play with it in Special:ExpandTemplates. If it appears to work then you could rework MonsterNoTile. I think that's safer and more maintainable than having #ifexist inside one big template. But I'm the newbie here, so I'm okay with however you want to go. Furey (talk) 18:19, 17 June 2024 (UTC)
Furey says we should not use the ifexist function
Demonstration:
- open https://nethackwiki.com/index.php?title=Special:WantedPages&limit=5000&offset=0
- search for "Furey says"
- find the page that links to "Furey says ..."
- open up the source and see the #ifexist.
Furey (talk) 19:57, 17 June 2024 (UTC)
- Oh yeah, that's definitely right. In fact, we actually have a template with an ifexist already, that would seem to duplicate the modifications I just did: Template:autotile, which is used in some item templates but not (currently) in the monster ones. Surprisingly, the big ugly redlink on the current monster templates actually doesn't add the page to Special:WantedPages, even though I'd honestly expect it to.
- That being said, this modification isn't intended to reduce the backlog on WantedPages; it's meant to fix what I see as an ugly display problem (the redlink on monster templates is really prominent, particularly in how it tends to wrap). But you're right that it will add a few hundred more pages to that backlog. To that end, I did create Template:LinklessExists, as you suggested. I tested it out on Drow alienist, and it does appear that it behaves as you'd like, not adding the image to WantedPages. I'll revise MonsterNoTile to incorporate that in the next day or so. -Ion frigate (talk) 21:39, 17 June 2024 (UTC)
- This sounds great. I think I was conflating WantedFiles and WantedPages. WantedFiles has lots of entries for monster png files, and WantedPages has lots of entries for object png files. Also Languages/Lang has an #ifexist test and is spamming WantedPages with missing translated pages for foo/de, foo/fi, foo/ru. Once you are confident about the new LinklessExists we can use it several places. Furey (talk) 21:57, 17 June 2024 (UTC) Furey
Double check that article just as an FYI, it works properly if actually put in the tile section. --Umbire the Phantom (talk) 21:49, 17 June 2024 (UTC)
- Ah, thanks for testing that. -Ion frigate (talk) 03:03, 18 June 2024 (UTC)
Ready now?
I've updated it to use the LinklessExists template, rather than an ifexist - and it indeed appears that Arcadian avenger is no longer on WantedPages. It is also not on WantedFiles, but it has been added to category indicating that it needs an image. Personally I think that is a better way to go about it (I didn't know that WantedPages and WantedFiles existed until yesterday, whereas the category is right at the bottom of the article), but I wanted to check that others agree before committing the changes to the standard monster template. -Ion frigate (talk) 02:59, 18 June 2024 (UTC)
- I'm getting red on the bottom of Arcadian_avenger, missing category for Monsters missing tiles. Furey (talk) 03:11, 18 June 2024 (UTC)
- Yes, that's just because I haven't actually created the category yet - I was planning to do so once we modify the original monster template; if you click on that redlink, you'll see the category itself is populated, it just doesn't have any explanatory text. -Ion frigate (talk) 05:46, 18 June 2024 (UTC)