Template talk


From Sega Retro

Auto-generating production history

I have solved a problem. The code needs cleaning up and the output needs to be formatted better, but as a proof of concept, it's not a bad start.

Given a developer name and a known list of games the developer has worked on, I can retreive the role he/she played during each game's development.

e.g. Mie Kumagai (Sandbox, User:Black Squirrel/Sandbox3)

  • Sandbox –
  • User:Black Squirrel/Sandbox3 –


  • it's not clean or efficient (i.e. there may be other extensions better suited to this task)
  • every usage of Creditstable will need to be changed
  • it's complicated to explain. Basically I'm generating variables called CREDITS##NAME and transcluding big chunks of wiki pages

this prototype does not handle aliases or multiple roles or multiple platforms (and it's not ignoring square brackets yet), and it could theoretically be automated further to find relevant games, but yeah, this is a thing. Make it better. -Black Squirrel (talk) 14:28, 8 August 2017 (CDT)

I can't really think of a good way to automate credits. The best I've come up with is to have DPL pull from "Category:Mie Kumagai games credits" and about 1000 other similar categories. Not ideal. - Hivebrain (talk) 12:17, 9 August 2017 (CDT)
I did a bit of exploring. You can do this:

i.e. get a list of "backlinks". We could always have a whopping big GAMES category and do a categorymatch to filter things out. How you'd cleanly work out the release dates, I can't say. -Black Squirrel (talk) 13:18, 9 August 2017 (CDT)

categorymatch can use wildcards. - Hivebrain (talk) 14:06, 9 August 2017 (CDT)

gee (Hive)brain, what are we doing to do tonight

I think

the best course of action is merge ideas from template:CreditsTest into this template, and cruicially have it backwards compatible.

i.e. something like

<section begin="credits_whatever" />
{{creditsrow|Role here|person 1, person 2, person 3}}
{{creditsrow|Alternatively|person 4|person 5|person 6|whatever's easiest}}
{{creditsheader|Same headers as before}}
*'''This is valid too:''' but we'd discourage it going forward
|ref={{fileref|ButtsMagazine UK 01.pdf|page=4}}
<section end="credits_whatever" />

creditsrow would basically just return a bullet point. Splitting the ref from the source might make it easier to work with - dunno.

You'd then have algorithms in the creditsrow and creditsheader templates that will create variables that look like

{{#var:SomePerson}} = Mega Drive: Programmer|Special Thanks (Sega)|Master System: Whatever

(there may be better ways to format the string but you get the point. Probably want to pass the source through too. )

by doing it this way, we can add a check to creditstable to detect whether it has any "nested" creditsrow templates. If there aren't any, the creditstable template can put the page in a "THIS IS THE OLD CREDITSTABLE SCHEME" category - i.e. the wiki can tell us which pages need updating with minimal effort.

the only thing this doesn't do is give us the date of when the game was released. However, I don't really know how to easily sort things in mediawiki, so I'm not sure what I'd do with that information right now

the ProductionHistory template would transclude the "credits_whatever" section, compare names and pump out a list ("GAME (SYSTEM; DATE) -- ROLE1, ROLE2, ROLE3 (as ALIAS)")

I don't like having to put the section tags in manually but I don't think there's a workaround for that. -Black Squirrel (talk) 14:05, 16 August 2017 (CDT)

#lst apparently doesn't allow for sections in templates. Maybe we could use #lsth to transclude the whole "Production credits" section and then have an optional "console=" parameter in template:creditstable? I think I might prefer to drop creditstable entirely and use creditsTest with some modifications. It would be a lot cleaner. - Hivebrain (talk) 15:49, 16 August 2017 (CDT)


For games whose credits are duplicated across multiple platforms, I'm thinking it should look something like this:

| console=SMS,GG

There are two options: we can either parse "SMS,GG" on the wiki side before the store (i.e. the credits will be stored twice under different platforms), or on the SQL side in the query.

For wiki parsing, I've just written Template:Foreach, since we're playing with lists quite a bit - give it a list, a delimiter, and something to do for each cycle.





Due to the unique way MediaWiki parses things, I've used "[value]" as a substitute - change it to whatever you see fit.

also it will probably break with nested foreach templates due to the way variable names are handled. Something to think about, anyway -Black Squirrel (talk) 12:34, 20 November 2017 (CST)

double quotes

Evander Holyfield's "Real Deal" Boxing is causing problems because SQL doesn't like titles with " in them.

Thing is, I'm not sure why my fixes aren't working - I don't know if it's because the system's slow, or if I'm doing something genuinely wrong. If you look at Chris Cutliff:

Query: SELECT `date` AS `date` FROM `wiki_cargo__releases` WHERE name="Evander Holyfield's "Real Deal" Boxing (Game Gear)" AND console="GG" ORDER BY `date` LIMIT 100 Function: CargoSQLQuery::run Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Real Deal" Boxing (Game Gear)" AND console="GG" ORDER BY `date` LIMIT 100' at line 1 (localhost)

I've traced the issue down to Template:GetEarliestRelease, but look:

No results


it works fine on its own. ???? -Black Squirrel (talk) 11:58, 17 December 2017 (CST)

The game name is stored correctly in the database.[1] It looks to me like the cargo_query command in Template:ProductionHistory is failing with quotes. Quotes will probably have to be removed from all the databases. - Hivebrain (talk) 16:46, 17 December 2017 (CST)
I had experimented a bit with that - I settled on trying to replace all " characters with '' (to be converted back later) but it wasn't playing ball for some reason. -Black Squirrel (talk) 13:33, 18 December 2017 (CST)