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.
-
NialGrenville
- Regular
- Posts: 184
- Joined: Tue Aug 30, 2016 6:30 pm
- Projects: PaS: The Awakening; The Heart Woods; The Witch and the Fairy
- Organization: Gabe Works, Inc.
-
Contact:
#1
Post
by NialGrenville » Sat Oct 22, 2016 1:29 pm
I have searched for an explanation. No such luck came my way.
I am currently trying to figure out how to use class methods that return a string using dot notation. More specifically: in a Ren'Py label.
Code: Select all
init python:
class Nightmare(object):
def __init__(self, happening):
self.happening = happening
def having_nightmare(self):
return "you are having a %s Nightmare." % (self.happening)
def no_nightmares(self):
return "You sleep peacefully with no care in the world."
You = Nightmare(Terrifying)
While this seems to run fine in regular python via a print statement. I have no idea how Ren'Py tackles the situation. Since print is not necessarily how Ren'Py "talks." So having a statement like:
Code: Select all
print You.having_nightmare()
print You.no_nightmares()
Provides no results.
And weaving things into python will not work. Since Ren'Py demands a label or Ren'Py code in general.
Last edited by
NialGrenville on Sun Oct 23, 2016 10:32 pm, edited 1 time in total.
-
Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
-
Contact:
#2
Post
by Ocelot » Sat Oct 22, 2016 2:16 pm
If you want Python replacement for Renpy dialogs like
you can just invoke character object with string you want to say:
Default character for text which does not mention character is
narrator.
So you probably want followng:
Code: Select all
$ narrator(You.having_nightmare())
< < insert Rick Cook quote here > >
-
NialGrenville
- Regular
- Posts: 184
- Joined: Tue Aug 30, 2016 6:30 pm
- Projects: PaS: The Awakening; The Heart Woods; The Witch and the Fairy
- Organization: Gabe Works, Inc.
-
Contact:
#3
Post
by NialGrenville » Sat Oct 22, 2016 11:16 pm
Ah, thank you Ocelot! I have found a documentation on it. Statement Equivalents was the page I was looking for. I simply had not searched correctly for it. I have figured the renpy.say() would work, but I need to experiment quite a bit. I have crossed fingers in hope that I can interlope tons of information within classes correctly enough. So that when I convert the bulk to Ren'Py it will operate correctly.
Thank you for giving me some tangible info to search for!
EDIT: off topic, but, I have been gone all day with the code not changed. I come back home, and my code had been corrected.
https://www.youtube.com/watch?v=KkF8-vhVM_0 I am very scared...
-
Donmai
- Eileen-Class Veteran
- Posts: 1919
- Joined: Sun Jun 10, 2012 1:45 am
- Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
- Projects: Slumberland
- Location: Brazil
-
Contact:
#4
Post
by Donmai » Sun Oct 23, 2016 7:47 am
Never have any doubt about Ocelot's telepathic and telekinetic powers.

Users browsing this forum: No registered users