Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
375
First Language
Sarcasm
Primarily Uses
Gradient Text Script V1.3




Created by Neon Black


What is it?

This script has two main functions. First of all it allows text to be gradient meaning that it will be lighter on the top and darker on the bottom. Second it adds a text cache since that was only a few lines more and was kinda needed to reduce overhead (it works similar to another script, but with slightly different uses). There are a few options with gradient text that allow you to modify the exact style. This script also adds a fairly large buffer allowing different fonts to look slightly better. Note that this script does have a certain amount of overhead since it can take a single string and turn it into hundreds of "draw_text" methods on the first draw. The cache should cut down on most of this, so there shouldn't be much reason to worry. This does NOT get rid of text anti-aliasing.

How can I use it?

Simply place this script blow materials and above main and the rest will work on it's own. There are a few settings in that may be set to change the appearance slightly.

What does it look like?

NR6wk.png


Below are a few examples of changes made while using this script. The top one is default (without the script) while the bottom is what the same text looks like with the script installed. I'm not particularly happy with text "scrunching" but it shouldn't really be needed too often (I hope).

AZTmE.png
What does it work with?

The only thing it aliases is the Bitmap method "draw_text" so it should work with just about everything. If you see any issues, I can certainly fix them if need be.

How can I get the script?

Version 1.3 (base script, 10.14.2012) is available from my pastebin account here.

I would like to use this script.



This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.

Permissions beyond the scope of this license may be available at http://cphouseset.wo...d-terms-of-use/.

Author's Disclaimer:

So one of the things I missed the most when I switched from rpg maker 2k3 to rpg maker vx was the gradient style text. To me, text just felt too flat without it. I made this script simply to add gradient text (and added the buffer and text cache when I saw how easy that would be to do anyway). I actually rewrote this script twice because I was having issues with the first two. This one is actually the smallest and most functional (300 lines, 250 lines, and 150 lines without my massive 80 line header). My favorite thing about this script is how it creates the gradient text using a kind of "scanning" motion. Think of it like how an old CRT TV works. Anyway, as always, enjoy!
 
Last edited by a moderator:

hyde9318

RMC Coordinator
Veteran
Joined
Apr 1, 2012
Messages
2,593
Reaction score
680
First Language
English
Primarily Uses
RMMV
Pretty damn cool if you ask me.
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
375
First Language
Sarcasm
Primarily Uses
Applied a bug fix. Had an error relating to disposed bitmaps when restarting the game via "F12". Updated the version to 1.1.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,862
First Language
English
Can you add this to one of the window message systems out there that use escape characters? Like include an add-on snippet for Ace message system or something.

It is mainly to see how flexible the message system is. I am not really sure whether it is easy to add a simple extra command and tell it how to parse it without overwriting absolutely everything...
 
Last edited by a moderator:

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
375
First Language
Sarcasm
Primarily Uses
You actually shouldn't see any issues with the escape characters. Escape characters are actually handled by the message systems before any text is event drawn on the screen, so they'd be taken care of before they even get to this script. Unless there are some escape characters that work with the Bitmap.draw_text method, though I certainly haven't found any. Pretty much all the cases with escape characters in Ace are using the Window_Base.draw_text_ex method which just calls contents.draw_text for each character in the first place.

All this of course unless you are thinking of something completely different that I'm unaware of. The message systems I've tested this with seem to be compatible and work just fine.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,862
First Language
English
I was looking around the script but couldn't really see how to use it.

I was thinking something like



Code:
\grd["my text"] or something
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
375
First Language
Sarcasm
Primarily Uses
Ah, okay, I see what you mean now. Currently it just works to change all text to gradient, though I could modify it to make gradient a property of the Font class. Then adding an escape character for it probably wouldn't be too hard, at least not any harder than bold or italic is.
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
375
First Language
Sarcasm
Primarily Uses
Updated to version 1.2

Archeia pointed out a bug that caused certain fonts to get cut off on the left side, so I added an option to auto shift characters to the right as seen in the following:

bFoBg.png


This option can be enabled or disabled using the option at line 78 of the script (O_POSITION). It is disabled by default to prevent additional lag, though I did shift all characters to the right one pixel to prevent a bug I hadn't even noticed before. This should not affect anything unless you were counting on that one pixel.
 

Rello

GERGtheNERD
Veteran
Joined
May 15, 2012
Messages
207
Reaction score
13
First Language
Profanity
Primarily Uses
RMVXA
Script "Gradient Font" line 125: FloatDomainError occured.

Infinity



Code:
	  pal = (20 - (pal * 20)).to_i / 2
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
375
First Language
Sarcasm
Primarily Uses
What font are you using? Also, when did this occur? During what line of code if you know by chance? Like where what line called "draw_text" to cause the crash.
 
Last edited by a moderator:

Rello

GERGtheNERD
Veteran
Joined
May 15, 2012
Messages
207
Reaction score
13
First Language
Profanity
Primarily Uses
RMVXA
When I opened my menu. Default font.

Menu.

Code:
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatusSW < Window_SelectableSW
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :pending_index		    # Pending position (for formation)
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(0, y + 64 + 10 - 25 , 640, 272+64+25)
    self.opacity = 0
    @pending_index = -1
    refresh
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    Graphics.width - 160
  end
  #--------------------------------------------------------------------------
  # * Get Window Height
  #--------------------------------------------------------------------------
  def window_height
    Graphics.height
  end
  #--------------------------------------------------------------------------
  # * Get Number of Items
  #--------------------------------------------------------------------------
  def item_max
    $game_party.members.size
  end
  #--------------------------------------------------------------------------
  # * Get Item Height
  #--------------------------------------------------------------------------
  def item_height
    (height - standard_padding * 2)/3
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    actor = $game_party.members[index]
    enabled = $game_party.battle_members.include?(actor)
    rect = item_rect(index)
    draw_item_background(index)
    if $game_party.battle_members.include?(actor)
	  draw_picture(actor.name + "_battle tile", rect.x + 1, rect.y) 
	  draw_text(rect.x + 1, rect.y + 12, 80, line_height, actor.name, 1)
	  draw_actor_hpmenu(actor, rect.x + 2, rect.y + 80 + 120 + 30, width = 80)
	  draw_actor_mpmenu(actor, rect.x + 2, rect.y + 80 + 120 + 24 + 30, width = 80)
	  draw_actor_exp(actor, rect.x + 2, rect.y + 80 + 48 + 120 + 30, width = 80)
	  draw_menu_level(actor, rect.x + 1, rect.y + 120)
    else
	  draw_picture(actor.name + "_battle tile", rect.x + 1, rect.y + 25) 
	  draw_text(rect.x + 1, rect.y + 12 + 25, 80, line_height, actor.name, 1)
	  draw_actor_hpmenu(actor, rect.x + 1, rect.y + 80 + 120 + 30 + 25, width = 80)
	  draw_actor_mpmenu(actor, rect.x + 1, rect.y + 80 + 120 + 24 + 30 + 25, width = 80)
	  draw_actor_exp(actor, rect.x + 1, rect.y + 80 + 48 + 120 + 30 + 25, width = 80)
	  draw_menu_level(actor, rect.x + 1, rect.y + 120 + 25)
    end

  end
  #--------------------------------------------------------------------------
  # * Draw Background for Item
  #--------------------------------------------------------------------------
  def draw_item_background(index)
    if index == @pending_index
	  contents.fill_rect(item_rect(index), pending_color)
    end
  end
  #--------------------------------------------------------------------------
  # * Processing When OK Button Is Pressed
  #--------------------------------------------------------------------------
  def process_ok
    super
    $game_party.menu_actor = $game_party.members[index]
  end
  #--------------------------------------------------------------------------
  # * Restore Previous Selection Position
  #--------------------------------------------------------------------------
  def select_last
    select($game_party.menu_actor.index || 0)
  end
  #--------------------------------------------------------------------------
  # * Set Pending Position (for Formation)
  #--------------------------------------------------------------------------
  def pending_index=(index)
    last_pending_index = @pending_index
    @pending_index = index
    redraw_item(@pending_index)
    redraw_item(last_pending_index)
  end
end
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
375
First Language
Sarcasm
Primarily Uses
I can't really see any issue with what you gave me, but based on the error you got the issue has to do with draw_text being given a width a 0 at some point. I've added a rescue line that should solve this issue. Version updated to 1.2b. You can get it from the main post.
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
375
First Language
Sarcasm
Primarily Uses
Version once again updated, this time to 1.3. Here are the changes:

  • Text placement made "smarter". This affects the left placement which had only been fixed while using certain settings in v1.2b as well as affecting centered and right aligned placement.
  • Fixed a bug where the offset option had no effect while gradient text was disabled.
  • Fixed a bug with Ace's default text cache that caused certain fonts to have their left edge cut off even when there was adequate room on the left side. This actually made ALL letters in my cache look funny when using certain fonts.
  • General code restructuring which was required to all certain fonts to work properly.

The main post has been updated to include the main script.
 

ShinGamix

DS Style 4Ever!
Veteran
Joined
Mar 18, 2012
Messages
3,906
Reaction score
458
First Language
April Fools
Primarily Uses
N/A
This is great! I made a windwoskin that was hard to see the text contrast.

*rushes to test it out!

-So how do I get it to change the text? a script call notetags?
 
Last edited by a moderator:

ThunderGirl

Warper
Member
Joined
Jan 13, 2014
Messages
3
Reaction score
0
First Language
English
Primarily Uses
Wow!~ Just what I needed, but didn't realise until I stumbled upon this post ^_^
Because the font I'm using didn't show up properly, but now it does! 

Thanks a lot~
 
Last edited by a moderator:

Euphoria

Veteran
Veteran
Joined
Jun 27, 2013
Messages
378
Reaction score
93
First Language
English
Primarily Uses
I really love the way this looks, but it made my CMS really slow and would crash my game :(

It's probably a compatibility thing...

Will be using this next time though. Do you know of any scripts that just provide a gradient like this? I'd like to try that and see if it works.

Edit: Putting Mithran's text cache after your script seemed to solve the lag and crash! Maybe you should recommend that script too :p

Just a suggestion, take it however! :)
 
Last edited by a moderator:

Latest Threads

Latest Profile Posts

I hate seeing threads where less-experienced user's ask for an opinion of their project, and the thread is full of negative feedback by others who are clearly not the target audience. I feel bad for the OP, and I hope they understand that no game can appeal to everyone. :frown:
Hm, just found out I can't use loops, yay.
-Ele
I just wanna Covid to be over and I have my normal life back... Feeling so bad these days, what can I do?
Holy Moly BlackJack is Finally finished!
Don't judge me, I'm not great at the game.
BlackJack.png

Forum statistics

Threads
109,072
Messages
1,041,852
Members
141,566
Latest member
Mamaco
Top