Handling very long Item Names
#1
While working in my game's interface I remembered something that annoys for a very long time.
It's how RMXP is handling too long Item names.

Usually it squeezes the name to fit into the window which looks in my personal opinion very ugly.

Example:

[Image: xrpDb4r.png]

So I thought about a second row for the words. I lowered the fontsize of the game to make it look better in general and put this example together in Paint.

[Image: lVN7ix5.png]

So my question is, would it be easy to change the draw_item method to display the names like that instead of the old behaviour?
I guess it would require something to split the string when it reaches the limit of the first row and put the rest of the string into the second row.
But what do I know... I'm really bad at RGSS.
I'm just curious how one would set this up.

(It was quite hard to find such a long name in english. With german names it's alot easier to reach the limit of the window.^^)
Reply }
#2
You would need to either count how many spaces fit the window or look for the last empty space and split the name right before that space. Or mix both ways...
  • This option would split words as well:
    This is a long na
    me for a sword
  • This one would attempt to keep it readable:
    This is a long
    name for a
    sword

In the former you would count how large is the string with string.size (and add a condition), while in the latter you would use self.contents.text_size(string) and a if statement or condition to determine when it should be split into two chunks. Here it would be measured in pixels not spaces.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
#3
The second option seems to be the better one.
But how would you check if the word still fits in the first row or not. Would the script count the amount of characters of each word and calcute with the total amount of possible characters for each row if it fits or not?
Reply }
#4
Or you could use the MACL addon, 'Draw Formatted Text' by Trickster. MACL stands for Method and Class Library, and is a collection of new methods you can use in RGSS scripts. And 'Draw Formatted Text' is an addition to the Bitmap class which lets you have text that wraps to the next line as you seem to want.

Rather than going into our Scripts Database board and hunt through the entire MACL system, you can just check LilyFrog's current/recent Code Support thread where I've been giving assistance. The last 'scripts.zip' file is a scripts.rxdata file which includes both Trickster's system, and a script by SephirothSpawn for scaled image blitting. Both are in the Bitmap class.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }
#5
That works really good.
Thank you for the tip.

I just had to make a check method to have the text centered if only one row is used.
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Plugin or Script help with Item menu, SKill menu, and Equip menu JayRay 2 66 11-20-2024, 03:09 AM
Last Post: JayRay
   Refreshing original skills names Whisper 2 5,033 05-31-2020, 04:35 PM
Last Post: Whisper
   I want to merge item classification and description extensions. zlsl 7 9,598 11-25-2019, 06:46 AM
Last Post: kyonides
   Need help with my menu - Current issue is item grid layout LilyFrog 41 39,357 09-24-2018, 02:03 AM
Last Post: LilyFrog
   Actor names in Quest Script jreagan406 5 8,643 03-07-2017, 08:06 AM
Last Post: JayRay
   A fourth column in MOG Scene Item Laura V1.2 Noctis 13 20,339 11-27-2016, 05:12 PM
Last Post: DerVVulfman
Exclamation  FF7s Hyper/Tranquilizer Item Script Petition Iqus 2 5,083 06-18-2013, 01:26 AM
Last Post: Iqus
   Cold's Bestiary and Item Book Vengan 0 3,570 05-27-2010, 08:59 AM
Last Post: Vengan



Users browsing this thread: 2 Guest(s)