User:Aldyron/Sandbox/Template List of monsters in habitat

Chaotic notes

 * The namespace constraint is currently redundant. Keep it if querying time is lower with it.
 * Temporarily admitting namespace User in order to include testbed monster page User:Aldyron/Sandbox/Kobold Shaman for dpl.


 * Using Missing in Action as our work-in-progress target quest gives no results. Using The Grotto gives 1 result. It's the system-wide limit of 500 again: when querying the whole alphabetic-sorted list of monsters (WASLOM), no monster from Missing in Action appears in the first 500 (the first one is Dog, beyond the 500th in the WASLOM, currently Darkfang Hunter), while one monster from The Grotto is in the first 500 (Aging Sahuagin Warrior).
 * That is, instead of querying everything and then limiting at 500, it queries at most 500 and then checks for matches. It will never be suitable this way. Showstopper.


 * Using Vault of Night yields a few results, useful for mixed-formats wrangling.
 * Eureka. Using linksto severely limits page selections to the few monsters that actually link to the quest. Less CPU load, less storage load, less time. Drawback: doesn't take redirects into account. Oh, well, I wanted to correct every link in every monster page anyway. :-)))
 * Must check that the link to the quest actually is in the habitat parameter, otherwise you get false positives (e.g.: Velah cites Vault of Night in the description parameter, but the monster is not in the quest).
 * Linked. Must provide for empty field values, otherwise we get . Employ phantom template. Update: done.
 * N.B.: Vault of Night should be The Vault of Night. It works anyway. Check for implications.
 * Using Missing in Action *and* Stealthy Repossession together, I'll have a Kobold Shaman for trying to make CR work. Will probe for more CR data points.
 * That's turning out to be a poor choice: it's looking more and more like Kobold Shamans always have a CR of 1/1/3/5. Probing continues.
 * It just occurred to me that I don't need accurate data for my test monster: I can invent. I *must* invent, in order to test edge cases.


 * I'm beginning to think Template:Infobox-monster is fundamentally flawed for what I have in mind. Update: I don't think so any more.
 * I currently have a "master" list of properties with optional quest-rows overriding some of the details quest-wise (and I'm possibly abusing the template while doing that). Adequate for Human readers, but not when you feed it to dpl.
 * I think I need a database-like modular structure containing quest-rows with *all* properties but the monster's name.
 * Yeah, right... That would mean repeating the constant properties row after row. Maybe better to have a default-row (basically what I have now, but in explicit row-form) and quest-rows of omitted or default-overriding properties.
 * I may be wrong. Must mull.
 * BTW, is it even *possible* to do it like that?
 * Maybe... sparse bidimensional matrix, Quest_Property=value, built in the individual monster's page, row by row, by an ancillary template; default row automatically built by feeding the same ancillary template the current data set; (useless?) counters updated by the ancillary template; all about *data*, not presentation. Sense-making, but possibly too heavy on the parser.
 * I possibly don't even need the default row: I can use the current data set. Even more backwards-compatible. :-)

Staging area

 * |includematch = /the grotto/i
 * It works, but we need a much stricter check.
 * |includematch = /\x7c\s*habitat\s*=\s*[^\x7c]*Missing in Action/i
 * |includematch =    /     \x7c     \s*     habitat     \s*     =     \s*     [^\x7c]*     Missing in Action     /     i  (rewritten for clarity)
 * (slash) opens the regex
 * matches the pipe character, |
 * matches whitespace/tabs/newlines in any quantity, including zero quantity
 * matches any character except | in any quantity, including zero quantity
 * (slash) closes the regex
 * at the end is a PCRE Pattern Modifier for caseless matching (though I personally prefer caseful matching)

Coding
(see source)