Jump to content
Kayzee

Word Wrapping Message Boxes

Recommended Posts

Aww shucks... *sprinkles fairy dust on you*

 

Those arrows are actually rather loose alignment guides more then anything else, and are completely useless if you change the resolution.

 

That's the thing; I never changed anything with respect to font type or size so I figured they would be accurate, but even out of the box they were inaccurate for me >_<

Share this post


Link to post
Share on other sites

Those margins are more like suggestions. Especially if you're using a face portrait. They're completely useless then. I've been several characters away from the first arrow, and still had text getting cut off.

 

I actually tweaked Killo's margin. Sometimes the last pixel or two of a character would touch the edge and mess up the wrapping. 

Share this post


Link to post
Share on other sites

It's the default RPG Maker Font. The problem was your script worked too well. One or two columns of pixels begin cutoff is barely noticeable so sometimes characters look like they're not being cut off in the preview window when they are. The margin you set is dead on so when that happens, the script does what it does. I tweaked it to give myself a little buffer. Occasionally, a character will get slightly cut off, but it's not really an issue. I'm usually really OCD about things like that, but it's acceptable to me so I don't think it'll detract from how professional it looks.  :D

 

I'm still baffled how word wrapping isn't a standard feature to begin with. That and Spell Check.

Anyway, I see Rikifive officially gave you an unofficial award so no Nobel Prize for you. Awesomely awesome script!  :D  :thumbup3:

Share this post


Link to post
Share on other sites

Well I am using the built in text width function to do it, and maybe that doesn't take into account shadows and things or messes up some letters. Anyway setting a few pixels of right margins isn't really a bad idea I guess!

 

Also, I have explained this before, but I think the reason it isn't a default feature is just because it was programmed in Japan. Japanese doesn't really use spaces as word boundaries, so all word wrapping that is done is always manual anyway. Though, I just looked up how HTML did it and apparently some people say in Japanese it's normal to wrap in the middle of words, so i dunno. I thought maybe they used zero width space characters or something.

Edited by KilloZapit

Share this post


Link to post
Share on other sites

I have an issue with the wrapping that  cuts off choices or overlays text from the first line on the second line (so the text gets unreadable in the 2nd line). There is a workaround with posting "\nw " in front of every affected choice.

I don't want the textwrap in any choice, just in the regular text boxes, where people talk ...

Is there a coding option to check if the text being handled is in a choice-field?


... and a screenshot.

Zwischenablage01.jpg

Share this post


Link to post
Share on other sites

Huh... I didn't know choiceboxs used draw_text_ex... Anyway, it's strange because I don't have that problem at all... choiceboxs should always be wide enough to fit the text in. I think this might be an issue with switching fonts? Only way I can see why it wouldn't size things right.

 

Anyway, here is a widdle script to force choiceboxes to not use my wordwrapping if you want to use it:

 

class Window_ChoiceList < Window_Command
  
  def process_character(c, text, pos)
    process_character_kz_window_base(c, text, pos)
  end
  
end
                                        

That said, the issue remains that your choiceboxes are smaller then they should be. If they don't wrap they will be cut off.  It might not be noticeable though. Another script may be at fault and changing the font when using draw_text_ex causing the size calculation to be wrong... or maybe you are using special control characters?

 

Edit: Now I am wondering if I can mess around with the way choiceboxes calculate width to do a better job...

 

Edit 2: Wow that was more simple then I thought... If you feel like it, try this, it should make choiceboxes resize better:

 

Spoiler

class Window_ChoiceList < Window_Command

  def max_choice_width
    Graphics.width
  end
  
  def process_character(c, text, pos)
    super(c, text, pos)
    @max_width = [@max_width, pos[:x]].max
  end
  
  def refresh
    @max_width = 0
    super
    self.width = [@max_width + 12, 96].max + padding * 2
    self.width = [width, Graphics.width].min
    self.x = Graphics.width - width
    self.arrows_visible = false
  end
  
end

 

 

Even works for control characters and icons too!

Edited by Kayzee

Share this post


Link to post
Share on other sites
6 hours ago, Kayzee said:

Edit 2: Wow that was more simple then I thought... If you feel like it, try this, it should make choiceboxes resize better:

Wow, thank you, it works like a charm!

You are awesome!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×