RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[VXA] Left-Side Currency Symbol/Icon

Started by Seiryuki, January 13, 2012, 10:47:57 PM

0 Members and 4 Guests are viewing this topic.

Seiryuki

~ Left-Side Currency Symbol/Icon v1.02 ~
a simple script to show the currency symbol,
or an icon, to the left of the money value

Requested by
Daemonium

Description
Allows for currency symbol, or a specified icon, to be displayed on the left-side of the money value instead of the default right-side.

Compatibility
- Version 1.02 adds the ability to set the location of the gold window for the scene_menu.
- Version 1.01 adds compatibility with YEA - Ace Core Engine's numeric digit grouping feature. Place this script below YEA - Ace Core Engine.

Instructions
See script for all the details on customising the icon etc. but is plug-n-play from the start.

Screenshots


Script
#===============================================
#  LEFT-SIDE CURRENCY SYMBOL/UNIT v1.02
#===============================================
# Author: Seiryuki
# Date: 2012-Jan-13
# Type: RGSS3/VXAce
#===============================================
# v1.02 Update 2012-Jan-14
# Added ability to set gold window's coordinates.
#-----------------------------------------------
# v1.01 Update 2012-Jan-14
# Updated for compatibility with YEA - Ace Core
#  Engine's numeric digit grouping feature.
#===============================================
# Description:
#  Allows for currency symbol/icon to be displayed
#  on the left of the money value.
#===============================================

module SeirGoldWin
# Set to false if you want to display the
# currency symbol/icon on the left for all gold windows.
# Set to true if you only want the currency
# symbol/icon on the left for the Scene_Menu only.
  APPLY_TO_MENU_WINDOW_ONLY = false

# Set to false if you wish to use currency text
# symbol you specified in the database.
# Set to true if you want to use an icon instead.
  USE_CURRENCY_ICON = true

# If using an icon, set the icon's index below.
  CURRENCY_ICON_INDEX = 361
 
# If set to true, location of gold window in
# scene menu is unaffected by GOLD_WINDOW_X_POS and
# GOLD_WINDOW_Y_POS values below.
# If set to false, set the location values in
# GOLD_WINDOW_X_POS and GOLD_WINDOW_Y_POS
  DEFAULT_GOLD_WINDOW_LOCATION_IN_MENU = true #default=true

# Set the x and y coordinates of the gold window.
# If GOLD_WINDOW_Y_POS = nil, the window is placed
# resting on the base of the screen.
#   (nil = Graphics.height - @gold_window.height)
  GOLD_WINDOW_X_POS = 0
  GOLD_WINDOW_Y_POS = nil #default=nil
end#module
#===============================================

# Apply effect to Scene_Menu's gold window only?
if SeirGoldWin::APPLY_TO_MENU_WINDOW_ONLY
  class New_WindowGold < Window_Gold
    def initialize
      super
    end
         
    def draw_currency_value(value, unit, x, y, width)
      value = value.group if $imported && $imported["YEA-CoreEngine"]
      cx2 = text_size(value).width
      change_color(normal_color)
      draw_text(x, y, width, line_height, value, 2)
      if SeirGoldWin::USE_CURRENCY_ICON
        draw_icon(SeirGoldWin::CURRENCY_ICON_INDEX, width - (cx2 + 20), y-2)
      else
        change_color(system_color)
        draw_text(x, y, width - (cx2 + 4), line_height, unit, 2)
      end#if
    end#def
  end#class
 
  class Scene_Menu < Scene_MenuBase
    def create_gold_window
      @gold_window = New_WindowGold.new
      if SeirGoldWin::DEFAULT_GOLD_WINDOW_LOCATION_IN_MENU
        @gold_window.x = 0
      else
        @gold_window.x = SeirGoldWin::GOLD_WINDOW_X_POS
      end#if
      if SeirGoldWin::DEFAULT_GOLD_WINDOW_LOCATION_IN_MENU || SeirGoldWin::GOLD_WINDOW_Y_POS == nil
        @gold_window.y = Graphics.height - @gold_window.height
      else
        @gold_window.y = SeirGoldWin::GOLD_WINDOW_Y_POS
      end#if
    end
  end

# Apply effect to all gold windows?
else
  class Window_Base < Window
    def draw_currency_value(value, unit, x, y, width)
      value = value.group if $imported && $imported["YEA-CoreEngine"]
      cx2 = text_size(value).width
      change_color(normal_color)
      draw_text(x, y, width, line_height, value, 2)
      if SeirGoldWin::USE_CURRENCY_ICON
        draw_icon(SeirGoldWin::CURRENCY_ICON_INDEX, width - (cx2 + 20), y-2)
      else
        change_color(system_color)
        draw_text(x, y, width - (cx2 + 4), line_height, unit, 2)
      end#if
    end#def
  end
if !SeirGoldWin::DEFAULT_GOLD_WINDOW_LOCATION_IN_MENU
  class Scene_Menu < Scene_MenuBase
    def create_gold_window
      @gold_window = Window_Gold.new
      @gold_window.x = SeirGoldWin::GOLD_WINDOW_X_POS
      if SeirGoldWin::GOLD_WINDOW_Y_POS == nil
        @gold_window.y = Graphics.height - @gold_window.height
      else
        @gold_window.y = SeirGoldWin::GOLD_WINDOW_Y_POS
      end#if
    end
  end#class
end#if
end#if
#===============================================
# END OF SCRIPT
#===============================================




Seiryuki

v1.02 Update: Ability to set gold window's location for scene_menu.