Can't get text to show on top of a screen, and when I do it doesn't come off

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
zeroTheHero
Regular
Posts: 64
Joined: Mon May 07, 2018 10:49 am
Contact:

Can't get text to show on top of a screen, and when I do it doesn't come off

#1 Post by zeroTheHero » Mon Jan 28, 2019 2:14 am

My code:

Code: Select all

show screen test_screen
    pause
    $renpy.transition(fade)
    hide screen test_screen 
    show screen hook 
    show text "{color=#000}{cps=10} When the world calls, I come.  I have come to save the world.{/color}{/cps}" onlayer over_screens 
    pause 
    hide text
    with dissolve
    $renpy.transition(pixellate)
    ...
I can't get the text to come off, even with hide text.
I think this is cuz of onlayer over_screens, but without it the text is hidden under screen hook and doesn't show up at all! How do I work through this?
Thanks!

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

Re: Can't get text to show on top of a screen, and when I do it doesn't come off

#2 Post by Imperf3kt » Mon Jan 28, 2019 2:32 am

Change zorder of screen, perhaps.

Need more info about the shown screens and other stuff to say for sure.

Your code looks like it could improve, too. You might want to consider the on statement to fade screens when hidden.
Why isn't the text part of screen hook.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Todo list:
Actually finish a project

zeroTheHero
Regular
Posts: 64
Joined: Mon May 07, 2018 10:49 am
Contact:

Re: Can't get text to show on top of a screen, and when I do it doesn't come off

#3 Post by zeroTheHero » Mon Jan 28, 2019 3:55 am

Imperf3kt wrote:
Mon Jan 28, 2019 2:32 am
Change zorder of screen, perhaps.

Need more info about the shown screens and other stuff to say for sure.

Your code looks like it could improve, too. You might want to consider the on statement to fade screens when hidden.
Why isn't the text part of screen hook.
I have already tried setting zorder to 1000, it doesn't work. Maybe I'm doing it wrong?

Code: Select all

show text "{color=#000}{cps=10} When the world calls, I come.  I have come to save the world.{/color}{/cps}" zorder 1000
The screen hook is a basic one

Code: Select all

screen hook:
    frame :
        add "bg1.png"
The screen above hook is a test screen and it's hidden, so I don't think it affects text.
Yes, I usually use with Transition(), I was testing $renpy.transition() here. How would 'on' work in this case though? I read the Transitions doc before but didn't really find it? (or maybe I didn't pay attention to it)
Thanks for the help!

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

Re: Can't get text to show on top of a screen, and when I do it doesn't come off

#4 Post by Imperf3kt » Mon Jan 28, 2019 4:18 am

On works within a screen.
Here's an example demonstrating everything I was suggesting.

Code: Select all

default changing_text = "Fried Chicken" 
screen test_screen() :
    on Hide renpy.transition(fade) #may be an action

screen hook() :
    zorder 50
    image black
    # image black should be defined within renpy internals, no need to define it
    text "[changing_text]" 
    # use standard positioning arguments to align text, or place it in a container such as a vbox, fixed, grid, etc.
    
    on Hide renpy.transition(pixellate)
    
label start:
    show screen test_screen
    pause
    hide screen test_screen
    
    window hide
    show screen hook 
    $ changing_text = "{color=#000}{cps=10} When the world calls, I come. I have come to save the world.{/color}{/cps}"
    pause
    hide screen hook
    window auto
You could also "call" a screen so you don't need to use pause, but then you need a way to close the screen.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Todo list:
Actually finish a project

User avatar
Wight
Regular
Posts: 47
Joined: Mon Jan 07, 2019 5:40 pm
Completed: A Transient Experiment
itch: wight
Contact:

Re: Can't get text to show on top of a screen, and when I do it doesn't come off

#5 Post by Wight » Mon Jan 28, 2019 6:22 am

When it comes to onlayer, I noticed that you also have to mention what layer the thing you want to hide is on.
Because you have "text" set to "onlayer over_screens", instead of simply "hide text", it should now be

Code: Select all

hide text onlayer over_screens 
This should make it work and have the text disappear.

zeroTheHero
Regular
Posts: 64
Joined: Mon May 07, 2018 10:49 am
Contact:

Re: Can't get text to show on top of a screen, and when I do it doesn't come off

#6 Post by zeroTheHero » Mon Jan 28, 2019 8:48 am

Imperf3kt wrote:
Mon Jan 28, 2019 4:18 am
On works within a screen.
Here's an example demonstrating everything I was suggesting.

Code: Select all

default changing_text = "Fried Chicken" 
screen test_screen() :
    on Hide renpy.transition(fade) #may be an action

screen hook() :
    zorder 50
    image black
    # image black should be defined within renpy internals, no need to define it
    text "[changing_text]" 
    # use standard positioning arguments to align text, or place it in a container such as a vbox, fixed, grid, etc.
    
    on Hide renpy.transition(pixellate)
    
label start:
    show screen test_screen
    pause
    hide screen test_screen
    
    window hide
    show screen hook 
    $ changing_text = "{color=#000}{cps=10} When the world calls, I come. I have come to save the world.{/color}{/cps}"
    pause
    hide screen hook
    window auto
You could also "call" a screen so you don't need to use pause, but then you need a way to close the screen.
Cool, I'll try it out!
PS what does 'image black should be defined within renpy internals, no need to define it' mean? I should define it outside of the screen? Or is it already defined by renpy?

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

Re: Can't get text to show on top of a screen, and when I do it doesn't come off

#7 Post by Imperf3kt » Mon Jan 28, 2019 9:23 am

That was a comment explaining why you don't need to define "image black" - it's already defined.

Oh and I haven't actually tested that code, so it might have some minor errors.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Todo list:
Actually finish a project

zeroTheHero
Regular
Posts: 64
Joined: Mon May 07, 2018 10:49 am
Contact:

Re: Can't get text to show on top of a screen, and when I do it doesn't come off

#8 Post by zeroTheHero » Wed Jan 30, 2019 9:46 am

Imperf3kt wrote:
Mon Jan 28, 2019 9:23 am
That was a comment explaining why you don't need to define "image black" - it's already defined.

Oh and I haven't actually tested that code, so it might have some minor errors.
Hey, so I tried it today but I get an error " u'renpy' is not a keyword argument or valid child for the on statement.
on Hide renpy.transition(fade)
[/code]

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

Re: Can't get text to show on top of a screen, and when I do it doesn't come off

#9 Post by Imperf3kt » Wed Jan 30, 2019 2:32 pm

Okay, it mustn't like renpy.transition(pixellate)
Remove the renpy. part, you may have to capitalise transition.
Note it's in the code twice.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Todo list:
Actually finish a project

zeroTheHero
Regular
Posts: 64
Joined: Mon May 07, 2018 10:49 am
Contact:

Re: Can't get text to show on top of a screen, and when I do it doesn't come off

#10 Post by zeroTheHero » Wed Jan 30, 2019 11:06 pm

Imperf3kt wrote:
Wed Jan 30, 2019 2:32 pm
Okay, it mustn't like renpy.transition(pixellate)
Remove the renpy. part, you may have to capitalise transition.
Note it's in the code twice.
Sorry but I can't get it to work... I tried all these combinations of capital/small letters, I still get the errors.

Code: Select all

on Hide Transition(Fade(0.5, 0, 0.5))
#on Hide Transition(fade)
on Hide Transition(Pixellate())

zeroTheHero
Regular
Posts: 64
Joined: Mon May 07, 2018 10:49 am
Contact:

Re: Can't get text to show on top of a screen, and when I do it doesn't come off

#11 Post by zeroTheHero » Thu Jan 31, 2019 2:31 am

Wight wrote:
Mon Jan 28, 2019 6:22 am
When it comes to onlayer, I noticed that you also have to mention what layer the thing you want to hide is on.
Because you have "text" set to "onlayer over_screens", instead of simply "hide text", it should now be

Code: Select all

hide text onlayer over_screens 
This should make it work and have the text disappear.
Wow I completely missed your post! This works!! In retrospect, this seems so common sense, just like everything in programming is XD. Thanks m8 ^_^

@Imperfekt I'd still love to see how to get 'on' working, I remember trying to get it to work before too but it gave me the same errors, getting over this would help a lot in making transitions. Also, thanks for taking the time to help! I'd be so lost without you guys here on lemma XD

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

Re: Can't get text to show on top of a screen, and when I do it doesn't come off

#12 Post by Imperf3kt » Thu Jan 31, 2019 2:56 am

I think I gave bad advice, I'll review the code later when I get a chance, I see now where I went wrong, but currently haven't got the time to write up a proper example.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Todo list:
Actually finish a project

zeroTheHero
Regular
Posts: 64
Joined: Mon May 07, 2018 10:49 am
Contact:

Re: Can't get text to show on top of a screen, and when I do it doesn't come off

#13 Post by zeroTheHero » Thu Jan 31, 2019 5:20 am

Imperf3kt wrote:
Thu Jan 31, 2019 2:56 am
I think I gave bad advice, I'll review the code later when I get a chance, I see now where I went wrong, but currently haven't got the time to write up a proper example.
It's okay, at least my problem's solved :) Have a great day

Post Reply

Who is online

Users browsing this forum: No registered users