newbie with questions

A place to discuss things that aren't specific to any one creator or game.
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Post Reply
Message
Author
chibialex-chan
Newbie
Posts: 8
Joined: Tue Jul 25, 2006 5:55 pm
Contact:

newbie with questions

#1 Post by chibialex-chan »

Hi I'm new to Ren'Py and I'm trying my darnest to figure it out and I think I'm doing pretty good so far. But I have a question. I'm trying to make a simple BL visual novel and so far the programing is doing good but I won't know is there any way that i could have a character portrait apper above the frame but only for a couple scence where I'd have art taking up the whole screen and the characters would be off screen.

I'm not sure I'm explaining this right so I made picuter to show sorta what I want http://chibialex.com/blog/muffin.jpg
The muffin would be the art the, yellow box would be the text frame and the balck and white image is the charater portrait.

Thanks in advance for the help.

Nafai
Veteran
Posts: 290
Joined: Thu Jun 29, 2006 2:10 pm
Projects: Elect: Ascendance
Location: Philippines
Contact:

#2 Post by Nafai »

Hiya!

Im new here myself. Dont know if this will help you any but you might want to check this thread of jake's: http://lemmasoft.renai.us/forums/viewtopic.php?t=1149

It has a way to show portraits and the like. Maybe there's a way you could only use it for part-game.

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#3 Post by monele »

Jake's system should work. If you don't want to use the whole thing, though, here's what PyTom gave me when I asked for the same system :

Code: Select all

init -50:
    python:
        def side_say(who, what, side=None, **kwargs):
            if side:
                ui.layer('faces');
                ui.image(side, xpos=10, ypos=589, xanchor='left', yanchor='bottom') # define the position of portraits here
                ui.close();
            renpy.display_say(who, what, **kwargs) 

    $ config.transient_layers = ['transient','faces']
    $ config.layers = ['master','transient','overlay','faces']
Put this somewhere in your script (around your initialization parts).

Then create a Character object for each portrait/character:

Code: Select all

init:
    $ marie = Character("Marie", function=side_say, side='marie.jpg', window_left_padding=148)
This creates a character named "Marie", which displays a portrait "marie.jpg" with text padded 148 pixels to the right (so it isn't over the portrait).

Then all you have to do is go

Code: Select all

marie "I'm talking with a portrait on my left."

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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:

#4 Post by PyTom »

While the code I gave monele will work in most cases, it might fail in some odd cases, like when used with the {p} or {w} text tags. Here's an updated version:

Code: Select all

init -1:

    python:

        def side_show_say(who, what,
                           who_args={},
                           what_args={},
                           window_args={},
                           image=False,
                           side=None,
                           **kwargs):

            ui.window(**window_args)

            ui.hbox()

            if side:
                ui.image(side)

            ui.vbox(style='say_vbox')

            if who:
                if image:
                    renpy.ui.add(renpy.display.im.image(who, loose=True, **who_args))
                else:
                    renpy.ui.text(who, **who_args)

            rv = renpy.ui.text(what, **what_args)
            ui.close()
            ui.close()

            return rv
Use it like:

Code: Select all

init:
    $ e = Character(u'Eileen', color=(200, 255, 200, 255),
                    show_function=side_show_say,
                    show_side="cyan.png")
I will probably be releasing an updated version of this code as an extra with 5.5.4, a version that supports predictive loading of the side image.

In general, the function= argument of Charcter is deprecated, in favor of show_function=. This is a fairly new change.
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

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#5 Post by monele »

Ohh! I *just* tried using {p} today and noticed it didn't work but I didn't insist because I could get the same effect with {fast} and a little more work. But that's good news! :D

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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:

#6 Post by PyTom »

Yeah, the problem is that Character and the associated functions have turned into a real mess. Probably in 5.6 I'll be reorganizing that whole thing, which may lead to some incompatible changes, but will probably lead to better code when the whole thing is done.
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

chibialex-chan
Newbie
Posts: 8
Joined: Tue Jul 25, 2006 5:55 pm
Contact:

#7 Post by chibialex-chan »

*scrunches up face* mmm... what all does that mean *neverous laugh* I'm trying to understand what it doning so that way if have to fix anything or change it I don't have to keep bothering everyone.

chibialex-chan
Newbie
Posts: 8
Joined: Tue Jul 25, 2006 5:55 pm
Contact:

#8 Post by chibialex-chan »

hmm.. is there any way to have mulpy portate of the same character with this code? How would you call them in the game?

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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:

#9 Post by PyTom »

The way to have multiple portraits with my code is to declare multiple characters. So you can declare heather_happy, heather_sad, heather_mad, and so on as separate Characters, with separate side images.

The Character class is somewhat misnamed, as it's less the representation of a single character, and more a way of saying how dialogue is shown to the user.
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

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#10 Post by monele »

Example code :

Code: Select all

$ kat = Character("kat_name", function=side_say, side='kat.png')
$ katmad = Character("kat_name", function=side_say, side='katmad.png')
$ kathap = Character("kat_name", function=side_say, side='kathap.png')
Then

Code: Select all

kat "What do you mean ?"
katmad "Are you making fun of me ?!"
kathap "Oh it was just a joke !"

(note : just replace "function" by "show_function" and "side" by "show_side"... my code is a bit old ^^)

chibialex-chan
Newbie
Posts: 8
Joined: Tue Jul 25, 2006 5:55 pm
Contact:

#11 Post by chibialex-chan »

ok I think I under stand.
So the set up in the init would be
init -1:

python:

def side_show_say(who, what,
who_args={},
what_args={},
window_args={},
image=False,
side=None,
**kwargs):

ui.window(**window_args)

ui.hbox()

if side:
ui.image(side)

ui.vbox(style='say_vbox')

if who:
if image:
renpy.ui.add(renpy.display.im.image(who, loose=True, **who_args))
else:
renpy.ui.text(who, **who_args)

rv = renpy.ui.text(what, **what_args)
ui.close()
ui.close()

return rv


init: #Peter's mugshot
$ pete = Character("peter_name", function=side_say, side='peter_port.png')
$ peteblush= Character("peter_name", function=side_say, side='petemad.png')
$ petehap = Character("peter_name", function=side_say, side='peterhap.png')


then to call it in the game it would be

pete "What do you mean ?"
petemad "Are you making fun of me ?!"
petehap "Oh it was just a joke !"


no have to use the show or hide commands? How would i turn off the portrates? Coudl I still do it with the hide comand? I'm sorry I'm pester everone with this. And there more question after this :oops: but first I want to get this nailed down :D

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#12 Post by monele »

Ain't looking in details (*darn tired @_@*) but it looks about right. Don't forget to indent lines in blocks though.

And you don't need to hide portraits that are displayed using this. They just appear along with the text, and only with that text.

If you mean having text with no portrait, well... just create a regular Character object I guess ?

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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:

#13 Post by PyTom »

That's right, except you want to use show_function instead of function, and show_side instead of side. But the basic idea is right.
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

Post Reply

Who is online

Users browsing this forum: No registered users