• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Resource icon

RGSS Rich Presence Integration 2.2

This script provides an easy wrapper around Discord's Rich Presence API for RPG Maker XP (maybe VX/VXa idk haven't tested them and nobody would care anyway since they're BAD).
"But what is Rich Presence??" I hear you ask... Well, Rich Presence allows you to "add beautiful art and detailed information to show off your game even more" through Discord. Sound cool? Ok, let's continue.

PLEASE NOTE: This script does not provide any Rich Presence functionality, just the capability. In the future I may create a starter script that provides basic information about the game state, but I encourage you to be a little creative/do my work for me.

To install, place the "Discord RPC API" folder into your Essentials plugins folder. Then add $DiscordRPC.shutdown to the last line of Main. (apologies it isn't completely plug and play)

You'll also need to add the corresponding (if using v19+, choose x64, if not choose x86) DiscordRPC_XP.dll and discord_game_api.dll files into your project's root folder, and you may also need the Visual C++ 2015 Redistributable too.

All done? Now for the setup. You're going to need a Discord account for this.

Go to this site here, log in, and hit New Application. Give it a name, preferably the name of your game, but you can change this later if you like. You'll be presented with a lovely screen with a fair amount of information, but at the moment all you care about is the Client ID. This is what you will use to interface with the API. Go back to Discord RPC API in your plugins folder section, open script.rb in a decent text editor and change the constant ID to your new application's Client ID.

Later, you may have to come back to your application's page to add previously mentioned "beautiful art", but for now you can close whatever browser you're using to view it.
To use this script, you need to do a few things:
  • Call $DiscordRPC.(parameter) = (value). There are a couple of parameters which I will cover later.
  • Call $DiscordRPC.update. This will ship all the data off to the Discord API to be displayed on your player's profiles. (you should only call this when there is a change in data)
Make sure you do not call any of these until after the game has finished initialising.

There are many things you can show with Rich Presence. Some would be useless in a noncommercial fangame setting, so I haven't implemented them. The ones I have implemented are:
  • $DiscordRPC.details - String that represents what the user is currently doing. You could use this to display what the player is currently doing (e.g "Overworld").
  • $DiscordRPC.state- Another string. Discord describes this one as "The user's current party status", but you could use it for something else, like where the player is or something
  • $DiscordRPC.timestamp_start - Integer representing epoch seconds for a "game start".
  • $DiscordRPC.timestamp_end - Integer representing epoch seconds for a "game end". No idea how or why you'd use this.
  • $DiscordRPC.large_image - Name of an image you have added to your application's art assets on your Discord Developer Portal, and NOT YOUR GAME FILES. Adding these assets is fairly self explanatory, just go to your Application's page, click Rich Presence then Art Assets then Add Image(s). This image will then be displayed as your game's big image next to all the text.
  • $DiscordRPC.small_image - Same as $DiscordRPC.large_image, but it displays as a small icon near the big image.
  • $DiscordRPC.large_image_text - String representing the text that is displayed when you mouse over the large image.
  • $DiscordRPC.small_image_text - String representing the text that is displayed when you mouse over the small image.
  • $DiscordRPC.party_size - Integer representing the size of a party.
  • $DiscordRPC.party_max - Integer representing the maximum size of a party.
That's all the parameters for the Rich Presence payload I have implemented so far, might add more.

That should be all. Please tell me if you encounter any bugs.
Credits
rainefall - Programming
Braze, Hackode007 - Testing
Discord Inc. - Activities API
Author
rainefall
Downloads
1,855
Views
3,535
First release
Last update

Ratings

5.00 star(s) 1 ratings

More resources from rainefall

Latest updates

  1. NoRequireDiscord fix

    hey all, had a little oversight in the previous version, launching the game without discord...
  2. Essentials v19 Compatibility Update (WINDOWS ONLY)

    It's been a long long time, I've had a while to think it over and by that I mean I've rewritten...
Back
Top