Dynamic World Quality content with Semantic MediaWiki
Hi all,
I'm doing an experiment to see if we can make the Wiki reactive to World Quality changes in a way that's helpful. The current changes are in place for some Rat Market pages. These things use Semantic MediaWiki under the hood, to let other content query the current value of World Qualities and update their own content accordingly.
Right now, the only place where we have up-to-date information about World Qualities is in the World Qualities Box that gets included on a handful of pages. This infobox is ideal for guide content, but is a bit heavyweight for Storylet/Action pages where it might push aside other content. Being one piece of content also makes it easy to keep up to date, which is important.
I have updated the {{World Quality}} template so that the page for a World Quality can be the Single Source of Truth for its current value. We should be able to use Alan's work at User:Alan/World Qualities to update this automatically. In particular, each page would be responsible for turning a numeric value like "1" into a user-facing one like "Runny."
Other pages can then query this value by using e.g. {{#show:Phase of the Rat-Moon:|?Has current value}}, which will inform you that the current moon phase is Runny. This can be used directly in Wiki text, and the Rat Market part of the World Qualities infobox is wired up to get its information from those pages. Supporting templates can also make this easier.
I made a thing called {{World Quality Condition}} which will suppress or delay based on World Qualities. See the docs page for more descriptions on what it does.
My Big Vision for how this will work is currently on display at The Smaller Stalls. The current features of {{World Quality Condition}} are rather narrowly targeted at what I wanted to have happen on this page. Basically, the options that are current available are displayed, while options that are locked this week get stored in a variable and displayed down-page under a different header. This organizes the page by current availability, and that organization stays up-to-date as the Rat-Season changes.
These changes could be applied to other Rat-Market pages, but I'm holding off for the moment because the "currently available" options would be empty. We won't find out what happens with Rat-Winds from the East until tomorrow.
Feedback and ideas are welcome, including if this seems more trouble that it's worth. The new Template feels rather verbose to call, and the Variable seems like it should be wrapped in a cleaner interface.
Updates
I went ahead and created some more helper Templates. Firstly {{Current Value}}, which I honestly don't know why I didn't create that thing to begin with. It will display the current value of the given World Quality. Please use this template, like, everywhere.
Second, from Alan's wishlist is {{World Unlock}}. This will annotate an Unlock condition with whether the condition is currently met or not. The use is a bit different than regular Unlock, which treats its second argument as a quantity. The valid values must be passed as the second argument, and are displayed afterwards because they are assumed to be named values rather than aliases. The current value is matched using substring searching, so a list of unlocking values functions correctly.