Can't use renpy.say() properly.

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
mdbanares
Newbie
Posts: 3
Joined: Fri Apr 20, 2018 11:37 pm
Contact:

Can't use renpy.say() properly.

#1 Post by mdbanares »

Hello there,

This question seems to be trivial for some, but I just couldn't get it to work properly.

So, I'm trying to optimise my calls in renpy so it doesn't require me to type in the same things over again.

I want to use renpy.say() function but I can't seem to convert it properly from:

Code: Select all

mc surprised "{cps=10}Hmm? An email?{/cps}"
I used this code

Code: Select all

renpy.say(mc surprised, "{cps=10}Hmm? An email?{/cps}) 
but it doesn't work.

It will only work if I use

Code: Select all

mc
as parameter, but not including the

Code: Select all

surprised
w/c basically is a change in player image.

Any advise?

My overall goal is to user renpy.say in a python function w/c takes in more parameters in setting up my dialogue window, transform, and others before showing it to the user. This will save me time in writing redundant code.

Code: Select all

$ say(DIALOG_ANIM_ZOOM_CENTER, vpunch, mc surprised, "{cps=10}Hmm? An email?{/cps}")

Code: Select all

init python:

    def say(anim_type, trans, who, msg):

        dialogAnimationType = anim_type
        renpy.with_statement(trans)
        renpy.say(who, msg)
Any help appreciated.

mdbanares
Newbie
Posts: 3
Joined: Fri Apr 20, 2018 11:37 pm
Contact:

Re: Can't use renpy.say() properly.

#2 Post by mdbanares »

Btw, mc surprised is defined this way...

Code: Select all

    def draw_girl_surprised(st, at):
        return LiveComposite(
        (500,1280),
        (0,0), "assets/images/characters/mc/body%d.png"%body,
        (0,0), "assets/images/characters/mc/face_surprised%d.png"%body,
        (0,0), "assets/images/characters/mc/clothes%d.png"%clothes,
        (0,0), "mc eyes normal",
        (0,0), im.MatrixColor("assets/images/characters/mc/hair%d.png"%hair,
                              im.matrix.tint(hairR, hairG, hairB) *
                              im.matrix.hue(hairHue)),
        (0,0), WhileSpeaking("mc","mc mouth normal","assets/images/characters/mouth_closed.png"),
        ), .1

Code: Select all

init:

     image mc surprised = DynamicDisplayable(draw_girl_surprised)
     image side mc surprised = LiveCrop((140,0,360,270),"mc surprised")
   

Code: Select all


define mc = Character("[firstName]",
                      ctc="ctc_dialogue",
                      ctc_position="fixed",
                      image = "mc",
                      color = "#ffffff",
                      window_background="gui/mc_dialog.png",
                      what_xpos = 0.425,
                      what_ypos = 0.6,
                      what_xanchor = 0.5,
                      what_yanchor = 0.5,
                      who_xpos = 0.05,
                      who_xanchor = 0.0,
                      who_ypos = 0.15,
                      who_yanchor = 0.5,
                      window_xpos = 0.525,
                      window_ypos = 0.625,
                      callback=speaker("mc")
                     )

User avatar
PyTom
Ren'Py Creator
Posts: 16088
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: Can't use renpy.say() properly.

#3 Post by PyTom »

You can't do this. You'd have to convert it into a combination of renpy.show and renpy.say.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

mdbanares
Newbie
Posts: 3
Joined: Fri Apr 20, 2018 11:37 pm
Contact:

Re: Can't use renpy.say() properly.

#4 Post by mdbanares »

Oh okay. Will try that. Thanks!

Post Reply

Who is online

Users browsing this forum: Google [Bot]