Ingame Wikipage Framework - Robosturm/Commander_Wars GitHub Wiki

Commander Wars ships with an ingame wikipage since Beta Release 6. As with all Commander Wars features the wikipage can be extended by mods or sending me content.

A wikipage has three functions and needs to have the javascript object name "LOADEDWIKIPAGE". The first function is getName which returns the name of the wikipage when searching for it: this.getName = function() { return qsTr("Metall Army"); }; The second function is getTags which returns the tags under which the page will be found: this.getTags = function() { return ["Army"]; }; The last function is loadPage which is called to create the wikipage. You can use loadHeadline to load a headline which is placed in the middle of the screen in a large font. You can use loadImage to load a scaled image which is placed in the middle of the screen. The names are those found in the "resources\images\wiki" or "resources\images\co" or "resources\images\game". The game chooses the first name it founds. You can use loadText to load a html styled text. this.loadPage = function(wikipage) { wikipage.loadHeadline(LOADEDWIKIPAGE.getName()); wikipage.loadImage("ma", 2); wikipage.loadText(qsTr("my page text"); };

Example Wiki Page for the Metall Army

var Constructor = function()
{
    // called for loading the main sprite
    this.loadPage = function(wikipage)
    {
        wikipage.loadHeadline(LOADEDWIKIPAGE.getName());
        wikipage.loadImage("ma", 2);
        wikipage.loadText(qsTr("The Metall Army is an army of robots. The robots were initially invented by Lash. ") +
                          qsTr("The Robots AI developped its own behaviour instead of following Lash's or Dark Matters orders. ") +
                          qsTr("The Metall Army defends it's own territory and all costs when it looses it's territory. The Army tries to reconquer it.") +
                          qsTr("Besides this the Metall Army is very defensive orientated and doesn't attack anyone."));
    };

    this.getTags = function()
    {
        return ["Army"];
    };

    this.getName = function()
    {
        return qsTr("Metall Army");
    };
};

Constructor.prototype = WIKIPAGE;
var LOADEDWIKIPAGE = new Constructor();