Today, I want to show you how to use that to do a fun little trick. In Vidar, I’ve added a menu option for “Feedback.” When selected, the game minimizes and opens up a google form! This is in fact just a URL that opens in your browser. You might guess that this has implications well beyond a simple feedback form. For example, you could use it to link the player to a wiki or walkthrough!
Make sureyou have Yanfly’s Menu Manager installed, and let’s get started.
Make a new section of script in RPG Maker, and add the following:
def open_url(filename) shell = Win32API.new("shell32", "ShellExecute", ['L', 'P', 'P', 'P', 'P', 'L'], 'L') shell.Call(0, "open", filename, 0, 0, 1) end
This is a little script that will take whatever URL we give it and open that in your browser! Pretty handy right?
We trigger it by just calling
and putting the web address in the quotes.
So, make a common event that does just that! In the contents, use a script call, and call open_url with your web address.
Make a note of the ID of your common event. It’ll be next to the event name in the column on the left.
Add It To the Menu
In Yanfly’s Menu Manager, scroll down to COMMON_EVENT_COMMANDS. Add an event (here I’ve got two) with the display name you want. If you want the link always available, set Enable and Show switches to 0. And add the ID of the common event you created above. Something like this:
Next, scroll up a little bit and add the :command name to your list of commands. Something like this:
And that’s it! Now when you open your menu in game, the entry will be right in the menu. Click it and the link will automatically be opened in the player’s browser.