/renpy_rpc

Ren'Py Discord Rich Presence, using python 3.6.

Primary LanguagePythonOtherNOASSERTION

Ren'Py RPC

pypresence

Download python.zip

Discord server, ℱŮℱṦøℬ#1337

Instructions:

  1. Put discord.py, setupRPC.rpy and python.zip in your game folder.
  2. Edit your splash.rpy [all labels are currently exist, you just need to add code] (code's below)
  3. Create your own Rich Presence application on Discord API page, Video Guide (till 0:58)
  4. Edit discord.py for your own, using your application id; adding assets and text you wanted.
  5. Add $ state = "something" everywhere you wanted status to change.
  6. Just run your game. First of all - it'll unzip python.zip and delete it after that. Then it will rewrite status to "Loading" and run discord.py. After you've tested that, you can public your project with rpc (including all 3 .py, .rpy(c) and .zip files).
splash.rpy
label after_load:
  # ...
  if discordrun:
      python:
          try:
              import io
              import os
              io.open("game/state.txt", 'w+', encoding = "utf-8").write(state)
          except:
              import io
              open("game/state.txt", 'w+')
              io.open("game/state.txt", 'w+', encoding = "utf-8").write("err3")
              state = "err3"
  # ...
  return

label before_main_menu:
  # ...
  if discordrun:
      python:
          import io
          state = "mm"
          io.open("game/state.txt", 'w+', encoding = "utf-8").write(state)
  # ...
  return

label quit:
  # ...
  if discordrun:
      python:
          import os
          os.popen('taskkill /f /im python.exe')
  # ...
  return

Examples:

Doki Doki Literature Club

As first big example I've chosen DDLC, 'cause it's my first VN (in particular - Ren'Py) game.

Edited files: script.rpy, screens.rpy, splash.rpy, script-ch*.rpy, script-exclusives*.rpy, script-poemresponses.rpy Added files: discord.py, setupRPC.rpy

To check how it works you just need to add all these files in DDLC "game" folder.

Known bugs:

  1. Incorrect text in "small image" when you have to choose in game.
Screenshots

Profile vision, small image text

Profile vision, large image text

Small vision

Small vision, large image text