Galv's Menu Themes Engine 1.6 (text alignment fix)

Parallax Panda

Got into VxAce ~2014 and never stopped...
Veteran
Joined
Oct 29, 2015
Messages
1,064
Reaction score
1,326
First Language
Swedish
Primarily Uses
RMVXA
Hello,

I'm using this script here by Galv but have encountered a small problem with text alignment when I changed the font:
https://galvs-scripts.com/galvs-menu-themes-engine/

What happened is that when I changed the display font (inside the script) from Arial, which is a monospaced font, to a new non-monospaced font a problem reveled itself.
Basically, since the font is not properly aligned to the left or right (I assume it centers itself) it jumps around a few pixels while displaying symbols with different sizes. This affects everything but is most visible in the lower right corner where the playtime is displayed. Since that clock is always ticking it is really noticeable when the text jumps around and I'd like it to be fixed. I also wouldn't mind the same fix for the gold and location text, even if the problem is not as obvious.

Truth is I've had the same problem with Moghunters "Monogatari menu" plugin for MV, and the solution was to simply specify the text to be aligned to the left (or maybe it was to the right, I can't remember which one worked). I'm sure that's an easy enough fix for someone who understands RGSS3 but I'm afraid I don't so I'd like to request some help here.

I don't mind editing the script myself if someone could tell me what to type, and on what line.

I'd really appreciate it.
 

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
56
Reaction score
10
First Language
português
Primarily Uses
RMVXA
can you upload a game demo with this script + whatever font you're using?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,651
Reaction score
562
First Language
English
Primarily Uses
RMVXA
upload a game demo
That's pretty easy. Just use the theme demo and add in a font.
I've done this easily and I can see the issue, but no idea how to correct it.
The game time moves because the characters that are drawn are not all the same size (I think).
Here is the demo with a font I use that shows it.
Watch the timer in the menu count from 09 to 11
 
Last edited:

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
56
Reaction score
10
First Language
português
Primarily Uses
RMVXA
thanks. I just don't want to set up demos when the OP could've done it in the first post hahahaha

For the playtime, you could set the text alignment to 0 and set different coords so it's at the bottom right again. at line 712, do something like
Code:
  def draw_playtime
    draw_text(400,ty,Graphics.width - 20,line_height,time_text,0)
  end
The only disadvantage is that if the player reaches a really long playtime and you want to keep the playtime on the lower right, the text might get cut off.

same script editing idea would apply to drawing the currency and area text

EDIT: @Parallax Panda I'd ask that you try to code it yourself first, but if you can't do it i'm willing to code a small patch fix
 
Last edited:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,651
Reaction score
562
First Language
English
Primarily Uses
RMVXA
After an hour reading up on Sprintf and trying options, the only way I found to make it seriously not move was to break it up.
Draw_text hour
Draw_text minute
Draw_text second

Ruby:
class Window_GameInfo < Window_Base
  def draw_playtime
    draw_text(Graphics.width - 125,ty,40,line_height,time_hour,0)
    draw_text(Graphics.width - 95,ty,10,line_height,":",0)
    draw_text(Graphics.width - 85,ty,40,line_height,time_minit,0)
    draw_text(Graphics.width - 55,ty,10,line_height,":",0)
    draw_text(Graphics.width - 45,ty,40,line_height,time_secon,0)
  end

  def time_hour
    hour = sprintf("%02d", (Graphics.frame_count / 60**2) / 60)
    time = "#{hour}".center(2)
    return time
  end

  def time_minit
    minit = sprintf("%02d", Graphics.frame_count / 60**2 % 60)
    time = "#{minit}".center(2)
    return time
  end

  def time_secon
    secon = sprintf("%02d", Graphics.frame_count / 60 % 60)
    time = "#{secon}".center(2)
    return time
  end
end
The center might not be needed, but that's where I left off with it working.
 

Parallax Panda

Got into VxAce ~2014 and never stopped...
Veteran
Joined
Oct 29, 2015
Messages
1,064
Reaction score
1,326
First Language
Swedish
Primarily Uses
RMVXA
Thanks for the replies (and for uploading a demo). I'm at little late to the party but to clarify, we're replacing the code on line 712 and 713 in Galv's script, correct?

The original code snippet is this:

Ruby:
  def draw_playtime
    draw_text(tx,ty,Graphics.width - 20,line_height,time_text,2)
I don't have a clue how to read or write Ruby or RGSS3 to be honest, so even simple syntax like how to align text is beyond me. So let me ask, in the above code snippet, is that "2" that's written at the end the alignment? is "0" center, "1" left and "2" right? I'm wildly guessing here.

Besides that, I'm presented with two solutions (one from each one of you) which is great. But as a non-coder I'm not sure which one would be best?
 

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
56
Reaction score
10
First Language
português
Primarily Uses
RMVXA
yea. 0 = left, 1 = center, 2 = right. (works only for draw_text)
but yes, both scripts lead to the same basic result, but look slightly different. depends on what you want for your game
roninator2's script:
1603954797292.png (spaced out)
my code edit:
1603954847843.png (same look)
 

Parallax Panda

Got into VxAce ~2014 and never stopped...
Veteran
Joined
Oct 29, 2015
Messages
1,064
Reaction score
1,326
First Language
Swedish
Primarily Uses
RMVXA
Thank you, very informative. I'll test both and see which ones would work the best.

As for how large numbers will make the playtime expand outside of the window/be cut off, are we alking something like 10.000+ hours? Or like...50 hours?
 

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
56
Reaction score
10
First Language
português
Primarily Uses
RMVXA
Thank you, very informative. I'll test both and see which ones would work the best.

As for how large numbers will make the playtime expand outside of the window/be cut off, are we alking something like 10.000+ hours? Or like...50 hours?
depends on the font size, but if you keep it to the right, probably 3+ digit hour counts. if it's on the left, you wouldn't have to worry about that unless you use 1 or 2 (center or right) text alignments
 

Parallax Panda

Got into VxAce ~2014 and never stopped...
Veteran
Joined
Oct 29, 2015
Messages
1,064
Reaction score
1,326
First Language
Swedish
Primarily Uses
RMVXA
Alright. Well, if it can at least go up to 999 hours then I wouldn't consider it to be a problem for 99.9% of the players. I'll experiment and try aligning the text both to the left and right though.

Thank you both for all the help. Really appreciate it.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,651
Reaction score
562
First Language
English
Primarily Uses
RMVXA
The numbers can be adjusted to make it closer as well.
1604008186912.png
Ruby:
class Window_GameInfo < Window_Base
  def draw_playtime
    draw_text(Graphics.width - 105,ty,40,line_height,time_hour,0)
    draw_text(Graphics.width - 80,ty,10,line_height,":",0)
    draw_text(Graphics.width - 75,ty,40,line_height,time_minit,0)
    draw_text(Graphics.width - 50,ty,10,line_height,":",0)
    draw_text(Graphics.width - 45,ty,40,line_height,time_secon,0)
  end

  def time_hour
    hour = sprintf("%02d", (Graphics.frame_count / 60**2) / 60)
    time = "#{hour}"
    return time
  end

  def time_minit
    minit = sprintf("%02d", Graphics.frame_count / 60**2 % 60)
    time = "#{minit}"
    return time
  end

  def time_secon
    secon = sprintf("%02d", Graphics.frame_count / 60 % 60)
    time = "#{secon}"
    return time
  end
end
 

Parallax Panda

Got into VxAce ~2014 and never stopped...
Veteran
Joined
Oct 29, 2015
Messages
1,064
Reaction score
1,326
First Language
Swedish
Primarily Uses
RMVXA
Alright, finally got the time to properly test it out and I got it to work, so thank you both very much for the help :)
 

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

Latest Threads

Latest Profile Posts

Once again working on a game I'm not sure I'm going to sell or even publish
That feel when you're awake past midnight and suddenly you're one year older :ninja:
I miss collaborations, but I don't know how to find someone to make face parts just to share them with others, and even though I don't like writing or music, I can't trust anyone with writing on my game because it has themes that are easy to mess up, and music needs a clear tone and scenes.
People donating to me for my upcoming birthday so I can pay my team a little. Such angels, I'm so happy. T uT I smile so much my face hurts. Good souls in this world.
Playing Ragnarok Online again is very nostalgic. The last time I played it was 20 years ago, when I was ten-twelve old.
My first mmorpg.^^

Forum statistics

Threads
105,571
Messages
1,014,723
Members
137,245
Latest member
dashstop
Top