[SOLVED] Showing repeat Text() with CPS again?

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
017Bluefield
Regular
Posts: 82
Joined: Mon Dec 30, 2013 1:55 am
Projects: Project Bluefield - Origins
Organization: Autumn Rain Studio
Deviantart: playerzero17
itch: autumn-rain-studio
Contact:

[SOLVED] Showing repeat Text() with CPS again?

#1 Post by 017Bluefield » Sun Jul 15, 2018 12:53 am

So I don't know if this has been addressed already, but I can't seem to find anything on this.

I'm trying to use the same Text() displayables over and over, which includes their cps. The problem is, while it works the first time it's shown, after it's hidden and shown again, it displays the Text() without the cps playing again. Am I missing something obvious?

Code: Select all

    image exceed_drive = Text("Exceed Drive:", color="#F669", size=27, bold=False, text_align=0.5, slow_cps=24)
    image exceed_drive howling_shot = Text("Howling Shot", color="#F33C", size=27, bold=True, text_align=0.5, slow_cps=60)

Code: Select all

    show exceed_drive at truecenter
    pause 2.0
    show exceed_drive howling_shot
    pause 1.8
    hide exceed_drive with dissolve
    
    ...
    
    show exceed_drive at truecenter
    pause 2.0
    show exceed_drive howling_shot
    pause 1.8
    hide exceed_drive with dissolve
Last edited by 017Bluefield on Mon Jul 16, 2018 8:45 am, edited 1 time in total.

User avatar
Remix
Miko-Class Veteran
Posts: 959
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I cannot draw very well)
Projects: An un-named 3d anime based trainer game
Contact:

Re: Showing repeat Text() with CPS again?

#2 Post by Remix » Sun Jul 15, 2018 2:06 pm

Though it takes a little more typing, you can get around it by having the text as a function return:

Code: Select all

init python:

    def exceed_drive():
        return Text("Exceed Drive", color="#F669", size=27, bold=False, text_align=0.5, slow_cps=24)

    def howling_shot():
        return Text("Howling Shot", color="#F33C", size=27, bold=True, text_align=0.5, slow_cps=60)

label start:

    show expression exceed_drive() as ed at truecenter
    pause 2.0
    hide ed with dissolve
    show expression howling_shot() as hs at truecenter
    pause 1.8
    hide hs with dissolve
    
    "..."

    show expression exceed_drive() as ed at truecenter
    pause 2.0
    hide ed with dissolve
    show expression howling_shot() as hs at truecenter
    pause 1.8
    hide hs with dissolve
Mad Scientist Todo List:
  • Finish Improved Event Handler
  • Implement DragonBones animation as a Creator Defined Container
  • Finish Catmull-Rom Spline pathing
  • Finish Bitmask collision and rebound vector system
  • Develop time based building mechanic
  • Others
  • *Find a superb artist and actually write a game*

User avatar
MaydohMaydoh
Regular
Posts: 101
Joined: Mon Jul 09, 2018 5:49 am
Projects: Fuwa Fuwa Panic
Tumblr: maydohmaydoh
Location: The Satellite of Love
Contact:

Re: Showing repeat Text() with CPS again?

#3 Post by MaydohMaydoh » Sun Jul 15, 2018 2:23 pm

Alternatively, the on show seems to get it working.

Code: Select all

image exceed_drive:
    truecenter
    on show:
        Text("Exceed Drive:", color="#F669", size=27, bold=False, text_align=0.5, slow_cps=24)
image howling_shot:
    truecenter
    on show:
        Text("Howling Shot", color="#F33C", size=27, bold=True, text_align=0.5, slow_cps=60)
    
label start:
    show exceed_drive
    pause 2.0
    hide exceed_drive
    show howling_shot
    pause 1.8
    hide howling_shot with dissolve
    
    show exceed_drive
    pause 2.0
    hide exceed_drive
    show howling_shot
    pause 1.8
    hide howling_shot with dissolve
You can also define the position in the image so you don't have to type it every time.

017Bluefield
Regular
Posts: 82
Joined: Mon Dec 30, 2013 1:55 am
Projects: Project Bluefield - Origins
Organization: Autumn Rain Studio
Deviantart: playerzero17
itch: autumn-rain-studio
Contact:

Re: Showing repeat Text() with CPS again?

#4 Post by 017Bluefield » Mon Jul 16, 2018 3:17 am

That did the trick! Thanks, you guys! :D

Post Reply

Who is online

Users browsing this forum: No registered users