Jump to content
Seiryuki

Left-Side Currency Symbol/Icon

Recommended Posts

~ 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 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

goldwindow.jpg

 

 

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
#===============================================

 

Edited by Seiryuki

Share this post


Link to post
Share on other sites

Ah, thanks for the script, going to see if it works better than the method I did (though I've encountered no issues with the way I do it, but I usually stray from editing core scripts since if I recall you're not supposed to lol ><)

 

This is what I do for example:

 

 

 

 def refresh
contents.clear
draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
   draw_icon(706, 0, 0)

 

In Window Gold I add the 'draw icon' line which makes it display like so:

 

drfneb.jpg

 

 

 

Since I also liked seeing the currency "vocab" next to it, but a visual representation if the type of coin it is on the far left.

 

 

Was that what you meant by instead of "default right size (the typical 'G' vocab)"?

Share this post


Link to post
Share on other sites

Ah, thanks for the script, going to see if it works better than the method I did (though I've encountered no issues with the way I do it, but I usually stray from editing core scripts since if I recall you're not supposed to lol ><)

 

Was that what you meant by instead of "default right size (the typical 'G' vocab)"?

Your way is great. I see no problem with modifying the core scripts once it is your personal game project. I may have done it your way too but:

 

Daemonium had requested for the "G" to be on the left side. He also asked for a gold icon instead of the G, also to be on the left side. So I made it an option. I try to avoid telling him to modify the core script in case something goes wrong later on, so I made the script and added a few customisation options.

His post here: http://www.rpgmakervxace.net/index.php?/topic/781-request-bundle-of-changes-for-the-main-menu/

Edited by Seiryuki

Share this post


Link to post
Share on other sites

That looks great!

I'm currently working on a script that supports multiple currencies (with changing money, exchange rates and other stuff), so when I release it, I'll make sure it's compatible with yours.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted