Detect if running on RenpyWeb

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
_sss
Newbie
Posts: 2
Joined: Tue Mar 30, 2021 3:49 am
Contact:

Detect if running on RenpyWeb

#1 Post by _sss » Tue Apr 06, 2021 7:09 am

Hi there,

Is there any way to check if the game is running on RenpyWeb? My problem is actually that I have videos (webm) in my game and videos are not supported by Renpyweb yet. So on the web platform, I'd like to be able to replace them by an image for example, doing something like this:

Code: Select all

	if is_renpy_web:
		scene myvidscreenhot
	else:
		$ renpy.movie_cutscene("myvid.webm")
Thanks!

uncoded
Regular
Posts: 27
Joined: Fri Apr 09, 2021 10:29 am
Contact:

Re: Detect if running on RenpyWeb

#2 Post by uncoded » Fri Apr 09, 2021 3:18 pm

I've never used RenpyWeb, so I suggest you either :
  • try to do with Python anything that would fail inside a browser (eg. writing a file on disk, doing a system call, ...) and try/except it : if you catch an error, is_renpy_web would be True.
  • ask your question by creating a ticket on renpyweb project ?
I don't have enough practice under my hood to answer more than that, sorry :?
🐾

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Detect if running on RenpyWeb

#3 Post by PyTom » Mon Apr 12, 2021 10:30 pm

Code: Select all

if not renpy.variant("web"):
    ...
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

uncoded
Regular
Posts: 27
Joined: Fri Apr 09, 2021 10:29 am
Contact:

Re: Detect if running on RenpyWeb

#4 Post by uncoded » Tue Apr 13, 2021 3:03 am

as simple as that 😅
thanks!
🐾

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], _ticlock_