Joe wrote: ↑01 August 2022, 16:22
EDIT:
Just messaged Mogri, the dev for Space Station Phoenix and Jump Drive and it is indeed that - the Game Dev has to define the images and their placeholders, in order to display on the How To Play section...
Sorry, I didn't see this until now.
This has to be set up by the developer, unfortunately, but it's not hard to do. Here's the secret sauce:
Code: Select all
onShowGameHelp: function () {
if (document.getElementById('mediawiki_gamehelp_content') == null) {
return;
}
dojo.place('<div class="loading_icon"></div>', 'mediawiki_gamehelp_content');
this.ajaxcall('/gamepanel/gamepanel/getWikiHelp.html', {
gamename: this.game_name,
section: 'help'
}, this, function (data) {
dojo.place(yourReplacementFunctionHere(data.content), 'mediawiki_gamehelp_content', 'only');
});
},
This method is automatically called when the game page is ready to load the help content. What I've pasted above is the exact function that the framework uses except for the addition of
yourReplacementFunctionHere.
For my projects, I have a substitution function that I use for most of the text I end up displaying, including wiki content. Here's an abbreviated version of the one Space Station Phoenix uses:
Code: Select all
translate: (msg) => {
if (!msg || !msg.replace) {
console.error('Invalid message', msg);
return '';
}
return msg
.replace(/\[SHIP(\d+)]/g, '<span class="ssp-icon ssp-icon-ship$1"></span>')
.replace(/\[VP(\d*)]/g, '<span class="ssp-icon ssp-icon-vp">$1</span>')
.replace(/\[GEM(\d*)]/g, '<span class="ssp-icon ssp-icon-gem">$1</span>')
.replace(/\[WATER(\d*)]/g, '<span class="ssp-icon ssp-icon-resource2">$1</span>')
.replace(/\[METAL(\d*)]/g, '<span class="ssp-icon ssp-icon-resource3">$1</span>')
.replace(/\[FOOD(\d*)]/g, '<span class="ssp-icon ssp-icon-resource1">$1</span>')
.replace(/\[RESOURCE(\d)]/g, '<span class="ssp-icon ssp-icon-resource$1"></span>')
.replace(/\[HUMANOID([1-6])]/g, '<span class="ssp-icon ssp-icon-humanoid$1"></span>')
.replace(/\[HUMANOID([1-6])x(\d+)]/g, '<span class="ssp-icon ssp-icon-humanoid$1">$2</span>')
.replace(/\[CARD(\d+)]/g, (match, shipId) => SSP.getTooltipShipTitle(shipId));
},
This swaps out the bracketed keywords for the symbols, which means it's responsible for every icon in the game that appears inline with text. It also lets me do neat things like make it so you can hover over the title of a card in the log and see the card as a tooltip.
If you are not a developer, this is of limited use to you, but you could try opening a suggestion ticket on your game of choice and
gently suggesting that the developer use this technique. If you want to link directly to this post, you can use
this URL.
The primary limitation of this method is that it only works inside of the game. A game's help wiki is also viewable from the game's detail page (
e.g.), and the icons won't appear there. But if the text you're substituting makes sense when the icon can't be substituted, it's not too much of a problem.