Page 1 of 1

Scrolling text in NVL mode

Posted: Sat Dec 31, 2011 6:05 am
by Taleweaver
Title says it all. How do I make the text scroll as it reaches the bottom of the window in NVL mode? And how does this work with Rollback?

Re: Scrolling text in NVL mode

Posted: Sat Dec 31, 2011 9:28 am
by PyTom
The current version of Ren'Py doesn't support scrolling the text when it hits the bottom of the window. (I'm not 100% what that even means - do we see the text moving up the screen?)

Re: Scrolling text in NVL mode

Posted: Sat Dec 31, 2011 4:37 pm
by Taleweaver
PyTom wrote:The current version of Ren'Py doesn't support scrolling the text when it hits the bottom of the window. (I'm not 100% what that even means - do we see the text moving up the screen?)
I know it doesn't support it. That's why I'm asking for a how-to. It must be able to code something like this.

What I'm thinking of is a classic scrolling effect, like in the good old times. You're in front of a computer screen, you enter text, and if you enter more text than fits on the screen, once you get to the end of the last line on the screen, all the text you've typed moves up one line and you get a new line at the bottom of the screen.

It has always bugged me that NVL mode doesn't already do that by itself. Instead, when the text goes below the bottom boundary, it just does that - it goes on, and you can't read it because it's below the bottom boundary. How do I make it just scroll upwards?

Re: Scrolling text in NVL mode

Posted: Sun Jan 01, 2012 6:55 am
by AxemRed
The complexity of a scrolling textbox depends on some implementation choices:
  • Is the up-scroll animated?
  • Is one line of text added at a time, or one sentence (possibly consisting of multiple lines)?
  • Are all lines the same height?
  • Is the text clipped at the top/bottom, or should there be a fading edge?
  • If there is a fading edge, is the background opaque?

Re: Scrolling text in NVL mode

Posted: Sun Jan 01, 2012 2:14 pm
by Taleweaver
  • Is the up-scroll animated?
    Needn't be. Would be sweet if possible, but it's not technically necessary.
  • Is one line of text added at a time, or one sentence (possibly consisting of multiple lines)?
    One sentence.
  • Are all lines the same height?
    Yes.
  • Is the text clipped at the top/bottom, or should there be a fading edge?
    Clipped.
  • If there is a fading edge, is the background opaque?
    There is no fading edge.

Re: Scrolling text in NVL mode

Posted: Sun Jan 01, 2012 3:02 pm
by SvenTheViking
I'm not certain how to do it at the moment, but it's certainly something I'd be interested in having in my code library, now that you bring it up. It would make any sort of console interaction with computers in-game much easier to handle, if nothing else. Give me a bit to come up with something, and I'll see what I can do.

Re: Scrolling text in NVL mode

Posted: Sun Jan 01, 2012 3:23 pm
by AxemRed
I implemented something like that a few years back (though not in Ren'Py).

Everytime you would normally append text to the main textbox, instead you create a new Text object for that text. Internally, you store a list of all Text objects created this way. When the new Text object is added, you update the positions of all the text objects -- Place the last-added Text object wherever you want it on the screen, the walk the list of Text objects last to first, positioning Text objects one above the other.

To add clipping, place the Text objects in a Viewport? (not sure about the name) with the clipping bounds you want. When a Text object is moved out of the clipping rect on the top (text.y+text.h < clip.y), destroy it and remove it from your internal list of Texts.

Re: Scrolling text in NVL mode

Posted: Sun Jan 01, 2012 4:01 pm
by SvenTheViking
I've hit a bit of a snag, in that I, for the life of me, can't understand the structure of the 'dialogue' list which contains the text to be displayed. Is it a multi-dimensional array placed inside a handy little wrapper or something? If so, how do I access individual elements, or, rather, the set of elements that is who, what, who_id, what_id, and window_id? There doesn't seem to be anything in the Ren'Py documentation on its structure, and it's only briefly mentioned in a few places, none of which do a bit of help in understanding how it works.

Am I better off digging through the source code for these answers?