[Plug-in] [Rpgmaker MV] Insert Website link on Title Screen

Software used: Rpgmaker MV

Hi everyone! I’m looking for a way to insert a website link (Like this patreon) to the title screen of an Rpgmaker MV project.

I have tested the Yanfly External Links plugin (it adds a button the the title screen and lets you attach a link) but noticed two things:

  1. The link opens within Rpgmaker and not the browser.
  2. The link looks like its forever loading rather than showing the website’s content.

I’ve received the same results when testing on other computers as well but found a temporary solution.

If I call this script the link I’m using opens up within browser and loads instantly:

game_website = 'https://www.patreon.com/cw/Degspart'

  

require('nw.gui').Shell.openExternal(game_website);

But I’m not sure how to add another title screen button that also allows me to call this script to achieve the results I’m looking for.

Does anyone know of a plugin or code that would allow me to add a new button to the titlescreen while also calling this exact script?

Any guidance is appreciated!

Also, please let me know if I’m using the translation button correctly on this post, I wasn’t quite sure I followed forum guidelines right here.

I think a small plugin would do it. Save this as TitleWebLink.js in your project’s js/plugins folder, then turn it on in the Plugin Manager:

/*:
 * @plugindesc Adds a title screen command that opens a website in the player's browser.
 * @author Baz
 *
 * @param Command Name
 * @desc The text shown on the title screen.
 * @default Patreon
 *
 * @param URL
 * @desc The website to open.
 * @default https://www.patreon.com/cw/Degspart
 */

(function() {
    var params = PluginManager.parameters('TitleWebLink');
    var commandName = String(params['Command Name'] || 'Website');
    var url = String(params['URL'] || '');

    var _makeCommandList = Window_TitleCommand.prototype.makeCommandList;
    Window_TitleCommand.prototype.makeCommandList = function() {
        _makeCommandList.call(this);
        this.addCommand(commandName, 'webLink');
    };

    var _createCommandWindow = Scene_Title.prototype.createCommandWindow;
    Scene_Title.prototype.createCommandWindow = function() {
        _createCommandWindow.call(this);
        this._commandWindow.setHandler('webLink', this.commandWebLink.bind(this));
    };

    Scene_Title.prototype.commandWebLink = function() {
        if (Utils.isNwjs()) {
            require('nw.gui').Shell.openExternal(url);
        } else {
            window.open(url, '_blank');
        }
        this._commandWindow.activate();
    };
})();

You can change the button text and the link in the plugin’s parameters. It runs the same openExternal call you found, so it should open in the player’s browser. Once it’s in, you can turn off YEP External Links so you don’t end up with two buttons.

Your post looks good too. The forum handles translation for other readers, so writing in English is all you need to do.

This works! Thank you very much for you’re expertise here! If you’re alright with it I’ll add you to the credits of my project for programming assistance.

If you’d rather have an image or region on the title screen that you can click with the mouse (or tap with mobile), here’s an alternative plugin. Originally developed by OtroNombreRaro but it started to get unwieldy when I wanted things at each of the 4 corners so I went “struct” on it… And made it supposedly work for JoiPlay & MZ, though I had to take other people’s word for it. Name this file “SupportLink.js”.

// Author: OtroNombreRaro
// altered by BishoujoHelper for clarity, optional links, single struct usage
// Version: 2.0
// This plugin allows you to solicit donations or provide support links in your game.
// Images can be shown on the title screen, and clicking them can open a link.
//=============================================================================
/*:
 * @target MV MZ
 * @plugindesc Displays multiple images on the title screen for a game logo, support banner, or donation message. Allows support for the game.
 * @author OtroNombreRaro & BH
 *
 * @command Support
 * @text Open Support Link
 * @desc Opens a given URL in the browser.
 *
 * @arg url
 * @type text
 * @desc URL to open
 * @default https://example.com
 *
 * @param Image_Settings
 * @desc Configuration related to each image. Double-click to open each struct member.
 * @type struct<ImageParams>[]
 * @default ["{\"Filename\":\"support_logo\",\"Xcoord\":\"20\",\"Ycoord\":\"400\",\"Link\":\"https://example.com\"}"]
 * 
 * @help
 * Displays one or more linkable images on the title screen.
 * Use them for donations, support, social media, etc.
 * Can be transparent if the content is already on the title screen.
 * Click/Tap the image region to open the specified URL in an external browser.
 * When no URL is given, it won't respond when clicked/tapped.
 * Default image name is "support_logo", but any in img/pictures can be used.
 * Double-click twice in Plugin Manager to access the block for each region you 
 * want on the title screen.
 * 
 * You can also open a link via plugin command in events:
 * - Plugin Command: Support https://example.com
 *
 * v2.0 - see CHANGELOG in .js file
 *
 */
/*~struct~ImageParams:
 * @param Filename
 * @type file
 * @dir img/pictures
 * @desc Image filename (in /img/pictures/)
 * @default support_logo
 *
 * @param Xcoord
 * @desc X position of the image's upper left corner
 * @type number
 * @default 20
 *
 * @param Ycoord
 * @desc Y position of the image's upper left corner
 * @type number
 * @default 400
 *
 * @param Link
 * @desc URL to open in browser when image is clicked/tapped, leave blank for none
 * @type text
 * @default https://example.com
 */
/*
============================================================================
Changelog
=============================================================================
Version 2.0 (changed by BishoujoHelper):
- Use one struct for all images and their parameters.
- Allow blank URLs on images, which don't try to open the browser.
- Handle "Plugin Command: Support" in both MV and MZ.

Version 1.3:
- Added more image logos by request.

Version 1.2:
- Added plugin command "Support" for use other link in game.

Version 1.1:
- Added support for Joiplay (thanks to "[ g f y ]" mod of Joiplay Discord.

 Version 1.00:
- Finished Plugin!
 */

/*jshint esversion: 6 */

(function() {
    const params = PluginManager.parameters('SupportLink');
    const imageSettings = JSON.parse(params.Image_Settings || '[]').map(JSON.parse);

    function openUrlExternal(url) {
        if (typeof NWJSApi !== 'undefined') {
            window.location = url;
        } else if (typeof require !== 'undefined' && typeof process !== 'undefined') {
            try {
                const gui = require('nw.gui');
                const shell = gui.Shell || require('nw.gui').Shell;
                if (shell && shell.openExternal) {
                    shell.openExternal(url);
                    return true;
                }
            } catch (e) {}
        }
        window.open(url, '_blank');
        return false;
    }

    const _Scene_Title_create = Scene_Title.prototype.create;
    Scene_Title.prototype.create = function() {
        _Scene_Title_create.call(this);

        this._supportLogos = [];
        let i = 0;
        imageSettings.forEach(region => {
            this._supportLogos[i] = new Sprite(ImageManager.loadPicture(region.Filename));
            this._supportLogos[i].x = Number(region.Xcoord);
            this._supportLogos[i].y = Number(region.Ycoord);
            this._supportLogos[i]._linkUrl = region.Link;
            this.addChild(this._supportLogos[i]);
            i++;
        });
    };

    const _Scene_Title_update = Scene_Title.prototype.update;
    Scene_Title.prototype.update = function() {
        _Scene_Title_update.call(this);

        if (TouchInput.isTriggered()) {
            const x = TouchInput.x;
            const y = TouchInput.y;
            for (const spr of this._supportLogos) {
                if (spr && spr.bitmap && spr.bitmap.width > 0) {
                    if (spr._linkUrl != "" &&
                        x >= spr.x && x <= spr.x + spr.bitmap.width &&
                        y >= spr.y && y <= spr.y + spr.bitmap.height) {
                        openUrlExternal(spr._linkUrl);
                    }
                }
            }
        }
    };

    if (Utils.RPGMAKER_NAME=="MV") {
        const _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
        Game_Interpreter.prototype.pluginCommand = function(command, args) {
            _Game_Interpreter_pluginCommand.call(this, command, args);
            if (command.toLowerCase() === 'support') {
                const url = args.join(' ');
                openUrlExternal(url);
            }
        };
    } else {
        PluginManager.registerCommand('SupportLink', 'Support', args => {
            const url = args.url || 'https://example.com';
            openUrlExternal(url);
        });
    }

})();