So, I want to add a tip to the loading screen, however I don’t know precisely how or whether it is possible.
What I’ve dug up with my study:
In the locales/en.json file, I’ve found the tips under “ui”:{“shell”:{“loading_screen”:{“tips”:{"###":“tips”}}}}.
But I don’t think that adding another line to that (mixin into the en.json from stonehearth) will work, scince things inside the en.json file generally are referenced to by other things. I suspect I would need to be in that other thing to say that a 28’th tip is now added.
But the en.json json structure follows the folder structure in the main game folder, so I could get to stonehearth/ui/shell/loading_screen. But there was no .json file for me to manipulate, only a folder with pictures, loading_screen.html which I presume is for the layout, a javascript (.js) file and a .less file.
Because of this, I’m starting to doubt whether it is possible to add another loading screen tip.
Does anyone know more about this?
Hi @nikosthefan,
I think mixin’ it into the en.json
is the only required step.
In the stonehearth/ui/shell/loading_screen/loading_screen.js
file, there is the _loadTipOfTheDay function:
_loadTipOfTheDay: function() {
var self = this;
var tips = i18n.t('stonehearth:ui.shell.loading_screen.tips', {returnObjectTrees: true});
var keys = Object.keys(tips);
var random = Math.floor(Math.random() * keys.length);
self.set('tips', tips[keys[random]]);
}
It looks like it will randomly choose a tip from the tips in the language json file.
You could temporarily modify the _loadTipOfTheDay function to use your new tip, if it is in the list of tips:
_loadTipOfTheDay: function() {
var self = this;
var tips = i18n.t('stonehearth:ui.shell.loading_screen.tips', {returnObjectTrees: true});
var keys = Object.keys(tips);
if(keys.indexOf('028') >= 0) {
self.set('tips', tips['028']);
return;
}
var random = Math.floor(Math.random() * keys.length);
self.set('tips', tips[keys[random]]);
}

That code did not work to show my tip, sorry.