BrandedTales

StoryTeller
Veteran
Joined
Dec 30, 2016
Messages
203
Reaction score
116
First Language
English
Primarily Uses
N/A
Greetings all -


Seeking some implementation wisdom.  I can post code if it helps, but my question is more at the implementation level than specific syntax.


I have a scene with two windows.  One window pulls a list of actors in a specific state.  This is a command window that the player can scroll through.


The second window dynamically generates information (essentially an NPC detail page) based on the actor currently selected.


One of the things I'm putting on that detail page is the actor.profile() segment.  I use the DrawTextEx for this.  Unforutnately, as soon as I do, the frame rate drops to terminal levels, and I can barely even navigate through the list any more.  I can truncate the profile to 100 characters and it works fine, but I start pushing 200 and I've got problems.  Some of these profiles may have upwards of 500 characters.


I'm currently drawing this content in the .refresh() function of the detail window.  To me, it seemed reasonable since I want the text to change when a new ._index is selected from the command window.  


My question is two-fold:


1) Is this behavior expected?  If not, I can post code and we can work through what I've done wrong...


2) If it is expected (and seems reasonable that it would be), is there a better way to draw large volumes of text on a page than using the DrawTextEx feature in the window.refresh()?


Thanks in advance!


EDIT:  I suppose I can try calculating the selected actor and pulling the text at the Scene level.  Then do my update during initialize (and open/close windows instead of using refresh).  That would save wear and tear on the refresh, but it feels a little clunky.  


Still very interested in other people's thoughts.
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,428
Reaction score
15,219
First Language
English
Primarily Uses
RMMV
Is there a reason you're using drawTextEx instead of drawText?  drawTextEx first reads through all your text looking for replacements where you've used \v \n and other escape codes that are replaced by text.  Then when it draws, it does it character by character, checking to see each time whether an escape code (like \i) is encountered.  It's a very slow process, and unless you are using escape codes in your profiles, there's no reason for it.


I suggest you try using drawText instead, and see what kind of difference it makes.
 

BrandedTales

StoryTeller
Veteran
Joined
Dec 30, 2016
Messages
203
Reaction score
116
First Language
English
Primarily Uses
N/A
I'm using <WordWrap> (not sure if that is built in or came from Yanfly's MessageCore)


Is there a better solution to get word-wrapping with DrawText?  As a note, DrawText definitely fixes the problem.


Thanks for advice!


Apologies for the questions! Still new to the scripting piece of this.  (=


EDIT:


Just wrote a function to parse/wordwrap the profile:


------
Window_NotablesDetails.prototype.parseProfile = function(profileText, lineLength) {
    var wordArray = profileText.split(" ");
    
    var retValArray = [];
    retValArray[0] = "";
    var rvIterator = 0;
    
    for (var i=0;i<wordArray.length;i++)
    {
        if ((retValArray[rvIterator].length || 0 + wordArray.length + 1) > lineLength) {

            rvIterator++;


            retValArray[rvIterator] = "";


        }


        retValArray[rvIterator] += (" " + wordArray
);

    }


    return retValArray;


};





--------





 





This works for my purposes, but I'm still very curious if others have answers more robust than this.
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,428
Reaction score
15,219
First Language
English
Primarily Uses
RMMV
No - the approach you've used is probably best - write a new function to take the features of drawTextEx that you're actually using, and use drawText instead.  It means you still get that extra bit of functionality but it's not checking every single thing.
 

Latest Threads

Latest Profile Posts

Worked on a cutscene skip domino effect using Maker Systems' script as the basis. Basically if I have a batch of cutscenes in a row on different maps, now when you skip one cutscene it will skip the entire set. No more spamming X to skip a scene every new map.

Oh and it will work regardless of where you do it from in the set. Convenient!
seems absolutely WILD to me now all the hundreds of hours of work I used to do in 2k(3) over a decade ago with a resolution of 320x240. that seems so insanely TINY now, seemed so normal at the time!
Playing Aroma Indosiar theme song.
Aroma is an Indonesian TV show about cooking. :)
Working on a characteeer! (Why is it so hard to color hair?) ;-;
Silly-Sketches.png
Just finished eventing a couple simple puzzles in RMMV, for my very first game "Sample Quest." Just messing around, throwing things together, and calling it a story XD On a non-RM note, got my hair cut today!

Forum statistics

Threads
115,379
Messages
1,089,392
Members
150,075
Latest member
Bridge36000
Top