Align Text in Show Text Command

Discussion in 'JS Plugin Requests' started by UgyBoogie, Jun 14, 2017.

Thread Status:
Not open for further replies.
  1. UgyBoogie

    UgyBoogie Veteran Veteran

    Messages:
    87
    Likes Received:
    120
    Location:
    Germany, BaW├╝
    First Language:
    german
    Primarily Uses:
    RMMV
    Hello :kaohi:
    I've really searched hard for something that seems so basic, but I just couldn't find anything. I want the text, that is displayed in windows via the "Show Text" command to have a certain alignment that is changable midgame. Usually it's aligned left, I need a right alignment as well.
    Since I'm using bust images in my game the overall thing would look a lot better if I have the character on the left half of the screen talking with left alignment, and the character on the right to have right aligned text. Would be great if this could be done either with a text command in the text window (example: \align[left/right]) or via plugin command.
    Thank you for your time! And if something like this already exists and I simply couldn't find it, please point me to it.
     
    #1
  2. djDarkX

    djDarkX Retro & Remastered Music Guru Veteran

    Messages:
    2,699
    Likes Received:
    1,887
    Location:
    Currently unsure...
    First Language:
    Music
    Primarily Uses:
    RMMV
    Buddy, I've asked for this several times since MV came out and it has never happened. Probably never will. I created the tool in my signature that somewhat helps if you're using the default font and do the manual adjustments via Yanfly's Message Core, but that's about it. I found a way around, but it's a bit clunky. I was able to get the effect I wanted, at least with a single line, by making the window go transparent and using an image of the message window for one line to be used. It's not exactly great, but it's the only way I've found to help me with that.

    Not sure it'll ever happen. Someone made a plugin that does it, but it's very incomplete and doesn't really work very well. Plus, it's not compatible with Yanfly's stuff. Sadly, we'll just have to do without. Besides, no one else seemed interested in supporting this when I asked.
     
    #2
  3. BrandedTales

    BrandedTales StoryTeller Veteran

    Messages:
    200
    Likes Received:
    111
    Location:
    USA - Nashville
    First Language:
    English
    Primarily Uses:
    N/A
    I also found it odd that such a plugin wasn't easily accessible.

    A quick search on the internet revealed this code in rpg_windows.js, which seems like it should be easy to overload and turn into a plugin. I'm not at a computer with RMMV on it right now so I can't check it myself, but I will when I get home from work tonight. That said, this seems so simple, I'm guessing the function doesn't do what it looks like. Will check when I get home if somebody doesn't jump in before then to slap down this idea!

    1. Window_Command.prototype.itemTextAlign = function() {
    2. return 'left'; //Change to 'center'
    3. };
     
    #3
  4. Naveed

    Naveed Veteran Veteran

    Messages:
    314
    Likes Received:
    144
    First Language:
    English
    Primarily Uses:
    RMMV
    @BrandedTales Sadly, it isn't as easy as that.

    Show text uses the 'drawTextEx' function, which doesn't have an alignment defined. This is probably because the drawTextEX function allows for text codes, so the text itself is more flexible, and the text cannot be known or read until it is written down. In the drawTextEx function, each character is processed individually so that escape codes can be converted, as can be seen in the function in the rpg_windows.js file.

    The code you showed was the alignment for ItemTextAlign, which uses the 'drawText' function (vastly different from the drawTextEx function). The text for items, skills, weapons etc are drawn using the drawText function, which does have an alignment defined. The drawText function does not allow for text codes (hence why you can't use codes like \c[x] or \n[x] in item and weapon names and such). So, the text itself is fully readable without being written down first, and thus can be aligned.

    So, sorry to say, but I do not see a plugin being made that can align a drawTextEx function.
     
    #4
  5. biud436

    biud436 Veteran Veteran

    Messages:
    151
    Likes Received:
    142
    Location:
    South Korea
    First Language:
    Korean
    Primarily Uses:
    RMMV
    This plugin allows you to easily change the align of the text in message system. To use this stuff, you should require a plugin called 'Yanfly Message Core'. Note that this text code is executed once before processing all texts. And it is also executed before reading each line. the text width is calculated by excluding all text codes at each line. So you can use three text codes as below :

    \TA[0] - LEFT
    \TA[1] - CENTER
    \TA[2] - RIGHT

    [​IMG]

    [​IMG]
     
    Last edited: Jun 15, 2017
    #5
    SOC, Weldy, cedr777 and 4 others like this.
  6. Chelyns

    Chelyns Warper Member

    Messages:
    4
    Likes Received:
    1
    Location:
    Bangkok, Thailand
    First Language:
    Thai, English
    Primarily Uses:
    RMMV
    I did register just only to reply you. After spend my time finding way to alignment text since RMMV came out, on google. I just bump into this topic today! you just solved my life time problem. Thanks a lot. I'm certainly that your plugin would be really helpful to other people out there. Tons of people asking for way to centered text by plugin rather than using \px. Thanks again.
     
    #6
    biud436 likes this.
  7. Chelyns

    Chelyns Warper Member

    Messages:
    4
    Likes Received:
    1
    Location:
    Bangkok, Thailand
    First Language:
    Thai, English
    Primarily Uses:
    RMMV
    I'm reply to myself after I continue working on my project, However there's an error every time I enter the shop after active your plug in.
    They probably any plug-in that is not compatible with?

    upload_2017-10-13_0-21-57.png
     
    #7
  8. biud436

    biud436 Veteran Veteran

    Messages:
    151
    Likes Received:
    142
    Location:
    South Korea
    First Language:
    Korean
    Primarily Uses:
    RMMV
    I've updated it. But that plugin is an add-on, so it should be installed the plugin somewhere below 'YEP_MessageCore'.
    Furthermore, To resolve an issue, You should have also checked a more detailed error in the developer tool.
     
    #8
  9. Chelyns

    Chelyns Warper Member

    Messages:
    4
    Likes Received:
    1
    Location:
    Bangkok, Thailand
    First Language:
    Thai, English
    Primarily Uses:
    RMMV
    Here's the error I get from Dev Tools
    upload_2017-10-15_2-49-34.png

    Any more information you need I do love to provided to you, just tell me.
     
    #9
  10. DavidFoxfire

    DavidFoxfire Veteran Veteran

    Messages:
    224
    Likes Received:
    44
    Location:
    St. Louis, MO
    OOOOOOH!!!!!

    {kneels before build436}

    Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You Thank You!!
     
    #10
  11. biud436

    biud436 Veteran Veteran

    Messages:
    151
    Likes Received:
    142
    Location:
    South Korea
    First Language:
    Korean
    Primarily Uses:
    RMMV
    Please update my plugin as 1.0.3 version.
     
    #11
    TheTitan99 and Chelyns like this.
  12. Chelyns

    Chelyns Warper Member

    Messages:
    4
    Likes Received:
    1
    Location:
    Bangkok, Thailand
    First Language:
    Thai, English
    Primarily Uses:
    RMMV
    And now, It worked magically. You're the best! Any further problem found I will tell you asap.
     
    #12
  13. Weldy

    Weldy Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    Indonesian
    Primarily Uses:
    RMMV
    AAAAAAAAAAA thank you very much, love u
     
    #13
  14. slimmmeiske2

    slimmmeiske2 Little Red Riding Hood Moderator

    Messages:
    5,686
    Likes Received:
    4,162
    Location:
    Belgium
    First Language:
    Dutch
    Primarily Uses:
    RMXP

    Weldy, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

     
    #14
Thread Status:
Not open for further replies.

Share This Page