Scripts open external windows RPG Maker MV.

It is something as simple as to open another window with these comands inside the script in-game boxes, using the prebuilt pdf lector of chrome, or the mp3 lector:
JavaScript:
window.open('url')
window.open('book.pdf')
window.open('music.mp3')
As you can see, it is not necessary to use YEP_External_Links.js. But you lack the control the plugin has. It's a shame, but easier than with plugins.

So RPG Maker MV's Built-in Chrome can both support m4a, ogg and mp3 files. I knew it from the first time i could open an external window.

AND PDFS. With pdfs you can just turn-it-around and create a fabulous book inside the game. It just another way to make permanent tutorials, stories, bestiaries and item books and loads of things.

So, my questions:
It's there any way to open an mp3 music without opening another window?.
Can we get advantage of external window opening in another ways? (see my other linked questions: Question 1, Question 2)
It is necessary to create a brand new plugin from scratch in order to do so, or it is viable with scripting?
I know only how to open a website, but there are ways to open files (if exist)
in the gamefolder which should be specified.

for any website you can use one of those:

// Open URL in a new window
window.open('https://github.com/nwjs/nw.js', '_blank');

// Open URL with default browser (Windows Or Mac Only)
require('nw.gui').Shell.openExternal('https://web-adress/nwjs/nw.js');

the best one is the shell.openExternal , as for open MP3 file from the root or audio folder,
I think you need to place ./audio/mp3 or similair, but I cant confirm that though.

else you need to make a plugin for it, that can open like that if it goes to the root directly.
// Open URL with default browser (Windows Or Mac Only)
require('nw.gui').Shell.openExternal('https://web-adress/nwjs/nw.js');
I suppose that with this you achieve to open an url within the game window?
Or is it for internet connected games?


Yes, for both pdf and mp3 you have to track the folder they are. But they open a new window though.
Is it possible to maintain it on game window?
// Open URL with default browser (Windows Or Mac Only)
require('nw.gui').Shell.openExternal('https://web-adress/nwjs/nw.js');
I suppose that with this you achieve to open an url within the game window?
Or is it for internet connected games?

I've just tried this piece of code, and what it makes is opening in on the net within the default PC browser.
It's not what I want to do, as i try to make an off-line game.
I know that if the game is off-line, an url example should not be used. But i used it 'coz it's the default purpose of the code.

So... in order to do what i want at the scale I want... i shall make a plugin, uh?
The window itself is always a browser of some sort (a local deployment is essentially a custom Chromium browser); its address/location determines which page/file is being displayed. You can directly get/set the window's current location value via a Script command, e.g.
JavaScript:
window.location = "https://forums.rpgmakerweb.com";
Not sure how you plan to let players navigate back to the game, though. 😅
Not sure how you plan to let players navigate back to the game, though. 😅
I think this is just my problem and i didn't know how to express it.
There should be a way to control the time you have been with the other window browser open or a way to get players back to the game.


For example, with a pdf you'll open the Chromium pdf reader and you'll have to close manually the window.

Original thread: https://forums.rpgmakerweb.com/threads/scripts-open-external-windows-rpg-maker-mv.122065/