Show Character doesn't work in screens?

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
olddog
Newbie
Posts: 18
Joined: Sun Dec 30, 2018 11:27 am
Projects: Kismet, a TF/TG game
Contact:

Show Character doesn't work in screens?

#1 Post by olddog »

Hi!

I'm starting with Ren'Py and getting into a bit. I've got a basic world set up with a map and rooms (placeholder image since I'm not an artist) and am now going through to start working on dialogue.

At the start of my game, I show characters chatting back and forth.

To handle the rooms, I show screens that contain the background, imagebuttons and imagemaps. And then I start a ui.interact loop to wait for the user to do something. I'm not sure if this is the proper way these days but I found the code for it and it's working.

However, after loading one of the rooms. "show <character>" no longer seems to work. So "show mary happy at right" does nothing, for example. The same command works fine before I start doing anything with screens (in the intro) but after that, it fails.

Help, please!

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
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:

Re: Show Character doesn't work in screens?

#2 Post by Donmai »

You can not use the "show displayable" statement inside a screen, but you can use "add".
https://www.renpy.org/doc/html/screens.html#add
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

olddog
Newbie
Posts: 18
Joined: Sun Dec 30, 2018 11:27 am
Projects: Kismet, a TF/TG game
Contact:

Re: Show Character doesn't work in screens?

#3 Post by olddog »

Is it not normal to use screens for rooms and such during a game? I thought that's how it was done due to the imagemap and imagebutton usage?

Also, is there a way to remove an image manually once added via "Add"?

envixer
Newbie
Posts: 23
Joined: Tue Jan 09, 2018 2:21 pm
Contact:

Re: Show Character doesn't work in screens?

#4 Post by envixer »

The way I do it is to use the scene command for the background, and then show screen for the UI, and show for the character.

Code: Select all

scene livingroom # Needs an image defined, or an image file called livingroom.
show screen calendar # Or whatever screen name you're using
show character
You can then use shows and hides to your heart's content.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Show Character doesn't work in screens?

#5 Post by Imperf3kt »

olddog wrote: Mon Dec 31, 2018 4:41 pm Is it not normal to use screens for rooms and such during a game? I thought that's how it was done due to the imagemap and imagebutton usage?

Also, is there a way to remove an image manually once added via "Add"?
You could do this a few ways, but I think the best approach is to use a variable to set whether the image shows, and change it within your script.
Then in the screen, the image shows orhides depending on the variable.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

olddog
Newbie
Posts: 18
Joined: Sun Dec 30, 2018 11:27 am
Projects: Kismet, a TF/TG game
Contact:

Re: Show Character doesn't work in screens?

#6 Post by olddog »

Is it better to use screens/Add to show characters or better to use envixer's recommendation to get the actual official "show" function working? I'm still at a point where I can make changes to the code and placeholders I'm using but I really don't want to get too far and have to overhaul everything.

I'd just like to try and nail down the recommended method.

Also, if I go envixer's route, how do I get characters (shown with the "show" command) to appear in front of imagebuttons?

envixer
Newbie
Posts: 23
Joined: Tue Jan 09, 2018 2:21 pm
Contact:

Re: Show Character doesn't work in screens?

#7 Post by envixer »

You might want to have a look at how layers work: https://www.renpy.org/doc/html/displaying_images.html

Usually, I just make sure my UI elements don't block the area where my characters will appear, but that's just me looking for an easy life. In the rare occasion where I need a character to appear above the buttons, I use a custom layer between screens and overlay (More info in the link above).

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot], Ocelot