[SOLVED] Making a polished epigraph? (Using Text() displayable)

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.
Message
Author
017Bluefield
Regular
Posts: 63
Joined: Mon Dec 30, 2013 1:55 am
Projects: Project Bluefield - Origins
Organization: Autumn Rain Studio
Deviantart: playerzero17
Contact:

[SOLVED] Making a polished epigraph? (Using Text() displayable)

#1 Post by 017Bluefield » Fri Jun 22, 2018 1:25 pm

I'm trying to make an epigraph that's more polished than "continuously reveal text at 24 cps". Of course, because I'm using a Text() displayable, tags like {w=2.0} have no effect.

Here's the code I'm using, minus the epigraph:

Code: Select all

image epigraph = Text(**EPIGRAPH GOES HERE**, size=32, slow_cps=24, first_indent=16)
Now here's the epigraph itself:
"\"Polyphemus? Why do you cry so sore in the starry night? You will not let us sleep. Sure no man's driving off your flock? No man has tricked you, ruined you?\"\n...\n\"Nohbdy, Nohbdy's tricked me, Nohbdy's ruined me!\"\n\n—from {i}The Odyssey{/i} by Homer, translated by Robert Fitzgerald"
Is there some way to work around this? My first guess would be multiple Text()s, one for each "paragraph"/"line break", stacked on top of each other.
Last edited by 017Bluefield on Sun Jul 15, 2018 12:47 am, edited 1 time in total.

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

Re: Making a polished epigraph? (Using Text() displayable)

#2 Post by Imperf3kt » Fri Jun 22, 2018 9:54 pm

Work around what? You haven't really stated what it is that it does, which you are dissatisfied with.
Image

Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

User avatar
Donmai
Eileen-Class Veteran
Posts: 1735
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
Projects: Slumberland
Location: Brazil
Contact:

Re: Making a polished epigraph? (Using Text() displayable)

#3 Post by Donmai » Fri Jun 22, 2018 10:32 pm

In "No Dice!" (one of my many many current projects) I prefer to use the centered character
(https://www.renpy.org/doc/html/dialogue ... characters) for a similar effect. This is how I use it:

Code: Select all

    scene black
    centered "{size=24}\"So God does play dice with the universe. All the evidence points to him being an inveterate gambler, who throws the dice on every possible occasion.\"{/size}\n{vspace=10}{size=15}{space=270}{i}– Stephen Hawking{/i}{/size}"
And this is how it looks on screen (click the image to enlarge):
nodice.jpg
This method lets you make use of any style/formatting tag that you want.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
Remix
Miko-Class Veteran
Posts: 890
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: Making a polished epigraph? (Using Text() displayable)

#4 Post by Remix » Sat Jun 23, 2018 6:35 am

Ren'Py takes "{space=0}" as a character, so we can spoof a delay in the cps writing by spamming a few of those:

Code: Select all

screen show_text(text=""):

    # Every \n replaced by 48 0px wide spaces and a \n
    # 
    $ text = text.replace("\n", "{space=0}"*48+"\n")

    fixed:

        text "[text]":

            slow_cps 24


label start:

     "Start"

    show screen show_text("word\nword\nword\nword")

    "End"
Alternatively, you could inline adjust the cps with "{cps=1}" or maybe "{cps=0.5}" for the first character of a line (or perhaps the slow ellipsis dots) then ramp it back up to 24 afterwards...

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

Re: Making a polished epigraph? (Using Text() displayable)

#5 Post by 017Bluefield » Sun Jun 24, 2018 10:31 pm

Imperf3kt wrote:
Fri Jun 22, 2018 9:54 pm
Work around what? You haven't really stated what it is that it does, which you are dissatisfied with.
Sorry about that.

What it does currently is that it makes the text appear, at a consistent 24 cps. That...doesn't really give the player much time to read the text before the epigraph fades out for the next part. What I'm trying to do is one of the following:
  • Add pauses in the text part of the Text() node (Check? The {cps=1} trick seems to work, if a bit clunky).
  • Figure out how to break up an epigraph into multiple Text() elements (one per "paragraph"), so that they line up vertically on the screen, and I can tweak them that way.

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

Re: Making a polished epigraph? (Using Text() displayable)

#6 Post by 017Bluefield » Sun Jun 24, 2018 10:34 pm

017Bluefield wrote:
Sun Jun 24, 2018 10:31 pm
...
  • Add pauses in the text part of the Text() node (Check? The {cps=1} trick seems to work, if a bit clunky).
  • Figure out how to break up an epigraph into multiple Text() elements (one per "paragraph"), so that they line up vertically on the screen, and I can tweak them that way.
Plus, I'm trying to make it aligned to the left (e.g. align=0.0). Problem is, it stays in the truecenter, which might have something to do with the fact that any change to that align= results in absolutely no change.

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

Re: Making a polished epigraph? (Using Text() displayable)

#7 Post by 017Bluefield » Sun Jul 15, 2018 12:47 am

This might be the closest I'll get to what I'm looking for:

Code: Select all

    image epigraph = Text("{cps=1}\"{/cps}Polyphemus?{cps=1} W{/cps}hy do you cry so sore in the starry night?{cps=1} Y{/cps}ou will not 
    let us sleep.{cps=1} S{/cps}ure[[ly] no man's driving off your flock?{cps=1} N{/cps}o man has tricked you,{cps=2} r{/cps}uined you?
    \"\n{vspace=10}{cps=2} ... {vspace=10}{space=32}\"{/cps}Nohbdy[[!]{cps=1} N{/cps}ohbdy's tricked me,{cps=1} N{/cps}ohbdy's ruined me!\"
    {cps=1}\n\n{space=90}{size=-14}—{/size}{/cps}{size=-14}from {i}The Odyssey{/i} by Homer,{cps=1} t{/cps}ranslated by Robert Fitzgerald{/size}",
    color="#FFC",
    size=30,
    slow_cps=24,
    first_indent=32)

philat
Eileen-Class Veteran
Posts: 1353
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: [SOLVED] Making a polished epigraph? (Using Text() displayable)

#8 Post by philat » Mon Jul 16, 2018 1:04 am

I know you marked this solved, but I was going through the forums and wanted to chip in. I don't really see the need for Text() displayables when usually straight dialogue will do just as fine. Is there a specific reason that the Text() displayable is needed? Additionally, as a random player feedback bit: I ran your example and it was annoying me because of how slow it is.

Code: Select all

init 9999: # this is only because I used centered, which is defined very late. I forget where, but 9999 is safest. You don't have to use it if you'd rather set the parameters from scratch, but it works well as a shortcut for this sort of thing.
    define epi_speaker = Character(None, kind=centered, what_size=30, what_slow_cps=24, what_text_align=0.0, what_xalign=0.0, what_xpos=30, what_first_indent=32)

label start:
    scene black
    epi_speaker "{w=.5}\"Polyphemus? {w=.3}Why do you cry so sore in the starry night? {w=.3}You will not let us sleep. {w=.3}Sure[[ly] no man's driving off your flock? {w=.3}No man has tricked you, {w=.1}ruined you?\"\n{vspace=10} {cps=5}... {vspace=10}{space=32}{/cps}\"Nohbdy[[!] {w=.3}Nohbdy's tricked me, Nohbdy's ruined me!\"{w=.3} \n\n{space=90}{size=16}—from {i}The Odyssey{/i} by Homer, translated by Robert Fitzgerald{/size}"

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

Re: [SOLVED] Making a polished epigraph? (Using Text() displayable)

#9 Post by 017Bluefield » Mon Jul 16, 2018 1:50 am

philat wrote:
Mon Jul 16, 2018 1:04 am

Code: Select all

init 9999: # this is only because I used centered, which is defined very late. I forget where, but 9999 is safest. You don't have to use it if you'd rather set the parameters from scratch, but it works well as a shortcut for this sort of thing.
    define epi_speaker = Character(None, kind=centered, what_size=30, what_slow_cps=24, what_text_align=0.0, what_xalign=0.0, what_xpos=30, what_first_indent=32)

label start:
    scene black
    epi_speaker "{w=.5}\"Polyphemus? {w=.3}Why do you cry so sore in the starry night? {w=.3}You will not let us sleep. {w=.3}Sure[[ly] no man's driving off your flock? {w=.3}No man has tricked you, {w=.1}ruined you?\"\n{vspace=10} {cps=5}... {vspace=10}{space=32}{/cps}\"Nohbdy[[!] {w=.3}Nohbdy's tricked me, Nohbdy's ruined me!\"{w=.3} \n\n{space=90}{size=16}—from {i}The Odyssey{/i} by Homer, translated by Robert Fitzgerald{/size}"
Doesn't that get recorded by $ _history, though?

philat
Eileen-Class Veteran
Posts: 1353
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: [SOLVED] Making a polished epigraph? (Using Text() displayable)

#10 Post by philat » Mon Jul 16, 2018 2:01 am

Yeah, but it's easier to toggle _history or use _history_list.pop() than it is to decipher the Text() displayable.

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

Re: [SOLVED] Making a polished epigraph? (Using Text() displayable)

#11 Post by 017Bluefield » Mon Jul 16, 2018 2:06 am

Got an error:

Code: Select all

While running game code:
  File "game/script.rpy", line 12, in script
    define epilogue_speaker = Character(None, kind=centered, what_size=30, what_slow_cps=24, what_text_align=0.0, what_xalign=0.0, what_xpos=30, what_first_indent=32)
  File "game/script.rpy", line 12, in <module>
    define epilogue_speaker = Character(None, kind=centered, what_size=30, what_slow_cps=24, what_text_align=0.0, what_xalign=0.0, what_xpos=30, what_first_indent=32)
NameError: name 'centered' is not defined

philat
Eileen-Class Veteran
Posts: 1353
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: [SOLVED] Making a polished epigraph? (Using Text() displayable)

#12 Post by philat » Mon Jul 16, 2018 2:29 am

init 9999.

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

Re: [SOLVED] Making a polished epigraph? (Using Text() displayable)

#13 Post by 017Bluefield » Mon Jul 16, 2018 2:39 am

Okay, so, I tried it with centered, which...worked, yes, but it presented two problems that I don't think I brought up in the initial post:
  1. The epigraph is part of a non-interactive sequence, meaning it has to play without the player having to touch anything until the whole sequence is over. This also means that Auto is active and the $ quick_menu is off (meaning the player can't set Auto during the sequence). Using centered like this means I was sitting there for a good 10 seconds, wondering why the epigraph was still there, before realizing "Oh crap, I forgot to set Auto."
  2. Text()-made images allow me to use Dissolve() and other visual effects; centered (a dialogue-based Character()) does not. It just blacks the epigraph out, which is jarring in a sequence where there are other Text() images called in with dissolves.

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

Re: [SOLVED] Making a polished epigraph? (Using Text() displayable)

#14 Post by 017Bluefield » Mon Jul 16, 2018 2:44 am

Added a init 9999: block and put epilogue_speaker into that...but got this:

Code: Select all

While running game code:
  File "game/script.rpy", line 272, in script
    epigraph_speaker "{w=0.5}\"Polyphemus?{w=0.3} Why do you cry so sore in the starry night?{w=0.3} You will not let us sleep.{w=0.3} Sure[[ly] no man's driving off your flock?{w=0.3} No man has tricked you,{w=0.1} ruined you?\"\n{vspace=10}{cps=5} ...{vspace=10}{space=32}{/cps}\"Nohbdy[[!]{w=0.3} Nohbdy's tricked me,{w=0.3} Nohbdy's ruined me!\"{w=1.0}\n\n{space=90}{size=-4}—from {i}The Odyssey{/i} by Homer,{w=0.5} translated by Robert Fitzgerald{/size}"
Exception: Sayer 'epigraph_speaker' is not defined.

philat
Eileen-Class Veteran
Posts: 1353
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: [SOLVED] Making a polished epigraph? (Using Text() displayable)

#15 Post by philat » Mon Jul 16, 2018 3:08 am

1. Typo, I assume. (epilogue_speaker and epigraph_speaker)

2. {nw} is available.

3. If you need effects, then yes, a displayable may be more suitable. You can dissolve in dialogue if need be, but it's probably not worth the hassle. So yes, if there is a good reason to use Text(), go ahead.

Post Reply

Who is online

Users browsing this forum: No registered users