RMMV Appending text to a window with scroll

Capitán

kind of a big deal
Veteran
Joined
Jul 9, 2013
Messages
572
Reaction score
145
First Language
Engilsh
Primarily Uses
RMMV
Ok, the title may be a bit confusing but I could not find a better way to summarize my issue.

So I have a window that periodically gets text added to it, when new text is added the old text is pushed up vertically by a fixed amount, (this is the first problem) I do not want the text to overlap, think "chat box" I'm very new to windows in rpg maker.

Here's a diagram of what I'm trying to explain

because the new text is always a different length I do not want the old text to be moved up by a fixed amount, how can i calculate how much the old text should be moved up by?

The second problem is once the window is full how do I create a scrolling effect? Right now i'm just clearing the entire window after a fixed amount of text has been appended, e.g. after 7 additions the window is cleared. By scrolling affect I mean I want all the text to stay in the box but as new text is added it continuously scrolls.

Thanks for listening, and I will appreciate any help.
 

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
366
Reaction score
336
First Language
german
Primarily Uses
RMMZ
because the new text is always a different length I do not want the old text to be moved up by a fixed amount, how can i calculate how much the old text should be moved up by?
You can use "this.fittingHeight(numberOfLines)" to the height, when you know or able to guess the number of lines of the text.

The second problem is once the window is full how do I create a scrolling effect? Right now i'm just clearing the entire window after a fixed amount of text has been appended, e.g. after 7 additions the window is cleared. By scrolling affect I mean I want all the text to stay in the box but as new text is added it continuously scrolls.
Let your Window inherit from Window_Scrollable. Use "this.scrollBaseY()" to get the y value of the text to be drawn. Then you need to override the "overallHeight()" method. As soon as this method returns a number being higher than the window itself, the scroll effect is applied automatically for you :)
 

Capitán

kind of a big deal
Veteran
Joined
Jul 9, 2013
Messages
572
Reaction score
145
First Language
Engilsh
Primarily Uses
RMMV
I really appreciate the answer and it did help, I the first problem is pretty much solved.
However, this is RMMV and Window_Scrollable does not exist in MV, perhaps Window_Selectable could be used in someway?
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,274
Reaction score
506
First Language
indonesian
I really appreciate the answer and it did help, I the first problem is pretty much solved.
However, this is RMMV and Window_Scrollable does not exist in MV, perhaps Window_Selectable could be used in someway?
you can try making a custom window named Window_Scrollable... make it's 'parent' Window_Selectable...
and try adding the Window_Scrollable code from MZ to that custom window.

maybe need some little fine tuning here and there... there's also potential problem with "Mouse part" (if MV and MZ have different mouse function name) but it's a start.

hope this help.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Oh no. That moment when you try to fix something you modified in your game, like, a year ago but didn't want to fix then, and you now have no idea what you even did. Me right now, trying to figure out why my gold window is over stretched?
LittlePIGGY wrote on atreyoray's profile.
Where are you TT^TT
We need ARP_InGameManual for MZ
Oh my gosh. Thank you, Macy's! Thank you so much! You have made me very happy!
Happy Thanksgiving everyone! What are you thankful for? I'm thankful that I no longer have PTSD, and that I get to enjoy a good meal with my mom and stepdad! It might not be the same as before COVID, but at least I still get to enjoy the holiday!

Forum statistics

Threads
105,550
Messages
1,014,565
Members
137,225
Latest member
Eryndor
Top