The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: modern algebra on February 13, 2010, 05:46:07 PM

Title: Extended Colour Palette
Post by: modern algebra on February 13, 2010, 05:46:07 PM
Extended Colour Palette
Version: 1.0
Author: modern algebra
Date: February 13, 2010

Version History



Description


This script allows you to have more colours beyond the 32 in the windowskin. It's primary use will be in messages, as you can now put in codes higher than \c[31]. Any numbers below 32 will take the colours from the windowskin.

Features


Instructions

Read the header for instructions. A sample colour palette is attached to the bottom of this post.

Script


Code: [Select]
#==============================================================================
#    Extended Colour Palette
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: February 13, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script allows you to have more colours beyond the 32 in the
#   windowskin. It's primary use will be in messages, as you can now put in
#   codes higher than \c[31]. Any numbers below 32 will still take from the
#   windowskin.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instruction:
#
#    Just place this script in its own slot in the Script Editor (F11) below
#   the default scripts, but still above Main. Then make a new picture in
#   System named whatever you have ECP_COLOUR_PALETTE_NAME as at line 38 (by
#   default, ColourPalette). In that picture, set the colours you want in 8x8
#   squares. It must have a width of 64, but can be as high as you want. To get
#   the first colour in the new palette, it is 32, and it advances to the
#   right, and then down to the next row.
#==============================================================================

#==============================================================================
# ** Window_Base
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new constant - ECP_COLOUR_PALETTE_NAME
#    aliased method - text_color
#==============================================================================

class Window_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * CONSTANTS
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # This is the name of the file that holds the extra colours you want to use
  ECP_COLOUR_PALETTE_NAME = "ColourPalette"
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Text Colour
  #    n : the colour desired
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalra_extndcolor_txtcolr_5ft1 text_color
  def text_color (n, *args)
    if n > 31
      colour_palette = Cache.system (ECP_COLOUR_PALETTE_NAME)
      n -= 32
      x = 4 + ((n % 8) * 8)
      y = 4 + ((n / 8) * 8)
      return colour_palette.get_pixel(x, y)
    else
      modalra_extndcolor_txtcolr_5ft1 (n, *args)
    end
  end
end

Credit



Support


Please post in this topic at RMRK for support. Do not PM me.

Known Compatibility Issues

No known compatibility issues.


Creative Commons License
This work by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
Title: Re: Extended Colour Palette
Post by: Cascading Dragon on February 13, 2010, 05:58:49 PM
Very nice. I never would have thought of this.