Which is your OS Ren'py?

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
hedleypty
Regular
Posts: 31
Joined: Mon Oct 20, 2014 12:52 am
Contact:

Which is your OS Ren'py?

#1 Post by hedleypty » Fri Apr 08, 2016 3:51 pm

Hey,

I am developing a Python tutorial and for this purpose I thought I was a good idea to open the developer options. The developer options allow to access a Python console, know the variables that currently exist and of course you are able to cheat (weee!).

Although I am not fan of cheating, a Python console in a Python tutorial, sounds cool. Unfortunately, such console is NOT available in Android devices. So it raises the question, does Ren'py can know which OS is running. The answer is a big NO! however Python can know that. So if it detects an Android...

If there is any mistake, make me know, Thanks!

See the code below:

Code: Select all

init:
    import re, os
...yada yada dialogues
...
label OS:
    python:
    if re.match(r".*(cyanogenmod|gbaedb).*", os.uname()[2]):
       h "The developer options are not available for Android"
       h "If you want to use it, please install this program in Laptop or desktop computer"
    else:
       h "You are about to open the developer console"
       h 'I know, that it sounds cheese but with "with a lot of power there is a lot of responsibility"'
       h "Please {color=#f00}NEVER CREATE A VARIABLE WITH THE SAME NAME THAT THE ONES THAT EXIT{/color}\nThe program for sure will break!"
       h "In the next dialog the game will restart"
       python
           persistent.developer = True
           renpy.quit(relaunch=True)

User avatar
PyTom
Ren'Py Creator
Posts: 15468
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: Which is your OS Ren'py?

#2 Post by PyTom » Fri Apr 08, 2016 5:28 pm

Actually, Ren'Py knows. You can test.

Code: Select all

if renpy.android:
    ...
if renpy.ios:
    ...
if renpy.mobile:
    ...

if renpy.windows:
    ...
if renpy.mac:
    ...
if renpy.linux:
    ...
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

hedleypty
Regular
Posts: 31
Joined: Mon Oct 20, 2014 12:52 am
Contact:

Re: Which is your OS Ren'py?

#3 Post by hedleypty » Tue Apr 12, 2016 9:07 am

Thanks. Tom!

Post Reply

Who is online

Users browsing this forum: FFY