Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> 


———
Before you ask! Read! ;)

You must have 30+ Posts to create a topic here!

Thanks for reading!
———

 
Reply to this topicStart new topic
> Switch currency tag location? [SOLVED], From 100 $ to $100?
Wonderjosh
post Feb 17 2012, 08:34 PM
Post #1


Level 3
Group Icon

Group: Member
Posts: 33
Type: Artist
RM Skill: Undisclosed




So I've been having a hell of a time looking for a script that does THIS:

Switches whatever the currency is (in this case, I'll just say $) from displaying "100 $" like it does by default, to displaying "$100".

Is it a simple edit to do or is there a little script around that does this? I can't seem to find a dang thing. Thanks.

This post has been edited by Wonderjosh: Feb 22 2012, 12:44 PM
Go to the top of the page
 
+Quote Post
   
Resource Dragon
post Feb 17 2012, 09:24 PM
Post #2


Dragon has RAWR. So... RAWR.
Group Icon

Group: Local Mod
Posts: 984
Type: Developer
RM Skill: Masterful
Rev Points: 95




Your talking about in the menu window right?


__________________________
click me ->Signup for Digital Hijinks!<- click me
Go to the top of the page
 
+Quote Post
   
Myst
post Feb 17 2012, 09:28 PM
Post #3


Level 4
Group Icon

Group: Member
Posts: 51
Type: None
RM Skill: Undisclosed




He means for the gold value to be displayed after the string
so instead of the gold menu saying "100 $" to say "$100" I know how to do this in RGSS2 but sadly not RGSS tongue.gif
it's a very easy edit, it should be in Scene_Menu if RGSS has the same name for it.

This post has been edited by Myst: Feb 17 2012, 09:29 PM
Go to the top of the page
 
+Quote Post
   
Resource Dragon
post Feb 17 2012, 09:54 PM
Post #4


Dragon has RAWR. So... RAWR.
Group Icon

Group: Local Mod
Posts: 984
Type: Developer
RM Skill: Masterful
Rev Points: 95




Thought so. Here you go. And yea, I knew what he meant, I wasn't thinking about what I typed lol. I realized the answer after I asked the question. XD

http://imaginationdworkshop.weebly.com/upl...ow_re-write.txt

Just copy and paste it above main.

This post has been edited by Resource Dragon: Feb 17 2012, 09:57 PM


__________________________
click me ->Signup for Digital Hijinks!<- click me
Go to the top of the page
 
+Quote Post
   
Wonderjosh
post Feb 18 2012, 01:09 PM
Post #5


Level 3
Group Icon

Group: Member
Posts: 33
Type: Artist
RM Skill: Undisclosed




Wow, hey thanks for the quick responses!

So I plugged the thing in, however the string still shows up in default form in battle (not using any battle scripts at the moment) and within Ryex's menu system, it's still in the same spot too, but the gold amount is squished up more toward the right where the string still is

At the moment I'm looking through the default scripts to see if I can edit it a bit. I know very little Javascript which lets me understand Ruby a little bit, but I'm more arts-oriented than I am script-oriented, haha. EDIT: Nope, no clue, haha.

Oh, and I mean to switch it up everywhere the gold amount is shown! I figure I will just use "$" since my project is modern-ish.

This post has been edited by Wonderjosh: Feb 18 2012, 01:41 PM
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Feb 18 2012, 04:08 PM
Post #6


Level 50
Group Icon

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed




I've tested this with Ryex's_Collapsing_CMS V 2.52 and it seems to work for me, but like Resource Dragon's script you'll need to change the G in the database to $.

CODE
#==============================================================================
# ** XP: Night_Runner's Alternate Gold Layout
#------------------------------------------------------------------------------
# History:
#  Date Created: 19/Feb/2012
#  Created for: Wonderjosh
#   @> http://www.rpgrevolution.com/forums/index.php?showtopic=55404
#
# Description:
#  This script changes the order of the gold text, so the gold symbol is in
#   front of the gold value.
#
# Compatibility.
#  This only works with the default scripts, with the gold in the pause
#   menu, the shop window and the battle results window.
#  Having said that, I've tried to make the module as standard as possible
#   by creating a draw_gold method, which was implemented in VX, so it may
#   work with other scripts that use the same standards.
#
# How to Install:
#  Copy this entire script. In your game editor select Tools >> Script
#   Editor. Along the left hand side scroll to the bottom, right click on
#   'Main' and select 'Insert'. Past on the right.
#==============================================================================



#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
#  This window displays amount of gold.
#==============================================================================

class Window_Base
  #--------------------------------------------------------------------------
  # * Draw Gold
  #--------------------------------------------------------------------------
  def draw_gold(*args)
    # Get the data from the input
    case args.size
    when 0
      x = y = 0
      width = 120
      gold = $game_party.gold
    when 2
      x, y = args
      width = 120
      gold = $game_party.gold
    when 3
      x, y, width = args
      gold = $game_party.gold
    when 4
      gold, x, y, width = args
    end
    # Create a rectangle to draw the text in
    draw_rect = Rect.new(x, y, width, 32)
    # Clear the bitmap
    self.contents.fill_rect(draw_rect, Color.new(0, 0, 0, 0))
    # Get the width of the gold string
    cx = contents.text_size($data_system.words.gold).width
    gx = contents.text_size(gold.to_s).width
    # Draw the strings
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, width - gx, 32, $data_system.words.gold, 2)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, width, 32, gold.to_s, 2)
  end
end


#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
#  This window displays amount of gold.
#==============================================================================

class Window_Gold
  #--------------------------------------------------------------------------
  # * Alias Methods
  #--------------------------------------------------------------------------
  alias nr_moneyprefix_refresh  refresh  unless $@
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(*args)
    nr_moneyprefix_refresh(*args)
    draw_gold($game_party.gold, 4, 0, 120)
  end
end



#==============================================================================
# ** Window_ShopNumber
#------------------------------------------------------------------------------
#  This window is for inputting quantity of items to buy or sell on the
#  shop screen.
#==============================================================================

class Window_ShopNumber
  #--------------------------------------------------------------------------
  # * Alias Methods
  #--------------------------------------------------------------------------
  alias nr_moneyprefix_refresh  refresh  unless $@
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(*args)
    nr_moneyprefix_refresh(*args)
    draw_gold(@price * @number, 4, 160, 328)
  end
end



#==============================================================================
# ** Window_BattleResult
#------------------------------------------------------------------------------
#  This window displays amount of gold and EXP acquired at the end of a battle.
#==============================================================================

class Window_BattleResult
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    x = 4
    self.contents.font.color = normal_color
    cx = contents.text_size(@exp.to_s).width
    self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
    x += cx + 4
    self.contents.font.color = system_color
    cx = contents.text_size("EXP").width
    self.contents.draw_text(x, 0, 64, 32, "EXP")
    x += cx + 16
    draw_text($game_party.gold, x, 0, 128)
    y = 32
    for item in @treasures
      draw_item_name(item, 4, y)
      y += 32
    end
  end
end



#==============================================================================
# ** End of Script.
#==============================================================================


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
Wonderjosh
post Feb 18 2012, 04:37 PM
Post #7


Level 3
Group Icon

Group: Member
Posts: 33
Type: Artist
RM Skill: Undisclosed




Hey, right on, man! That works in the menu perfectly!

I ran it through a battle and I'm getting a NoMethodError for line 137. Says "undefined method 'draw_text'#<Window_BattleResult:0x31d2250>

This is line 137:

draw_text($game_party.gold, x, 0, 128)

Any ideas what this error is referring to?

Also, in the shop, is there a way to add the $ in front of the price of the items in stock? Shows up everywhere else perfectly! (Where your current gold is displayed and when you confirm purchases of items, just not in the listed in front of the price of the items in stock of the shop.) But I mean that's just a little detail so if it's too much of a hassle, don't worry about it. I'm totally thankful for what you've done so far.

This post has been edited by Wonderjosh: Feb 18 2012, 04:41 PM
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Feb 19 2012, 02:46 AM
Post #8


Level 50
Group Icon

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed




Whoops, that was supposed to be draw_gold, not draw_text blush.gif

Attempt 2!

CODE
#==============================================================================
# ** XP: Night_Runner's Alternate Gold Layout
#------------------------------------------------------------------------------
# History:
#  Date Created: 19/Feb/2012
#  Created for: Wonderjosh
#   @> http://www.rpgrevolution.com/forums/index.php?showtopic=55404
#
# Description:
#  This script changes the order of the gold text, so the gold symbol is in
#   front of the gold value.
#
# Compatibility.
#  This only works with the default scripts, with the gold in the pause
#   menu, the shop window and the battle results window.
#  Having said that, I've tried to make the module as standard as possible
#   by creating a draw_gold method, which was implemented in VX, so it may
#   work with other scripts that use the same standards.
#
# How to Install:
#  Copy this entire script. In your game editor select Tools >> Script
#   Editor. Along the left hand side scroll to the bottom, right click on
#   'Main' and select 'Insert'. Past on the right.
#==============================================================================



#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
#  This window displays amount of gold.
#==============================================================================

class Window_Base
  #--------------------------------------------------------------------------
  # * Draw Gold
  #--------------------------------------------------------------------------
  def draw_gold(*args)
    # Get the data from the input
    case args.size
    when 0
      x = y = 0
      width = 120
      gold = $game_party.gold
    when 2
      x, y = args
      width = 120
      gold = $game_party.gold
    when 3
      x, y, width = args
      gold = $game_party.gold
    when 4
      gold, x, y, width = args
    end
    # Store the default font colour
    default_font_color = self.contents.font.color.clone
    # Create a rectangle to draw the text in
    draw_rect = Rect.new(x, y, width, 32)
    # Clear the bitmap
    self.contents.fill_rect(draw_rect, Color.new(0, 0, 0, 0))
    # Get the width of the gold string
    cx = contents.text_size($data_system.words.gold).width
    gx = contents.text_size(gold.to_s).width
    # Draw the strings
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, width - gx, 32, $data_system.words.gold, 2)
    self.contents.font.color = default_font_color
    self.contents.draw_text(x, y, width, 32, gold.to_s, 2)
  end
end


#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
#  This window displays amount of gold.
#==============================================================================

class Window_Gold
  #--------------------------------------------------------------------------
  # * Alias Methods
  #--------------------------------------------------------------------------
  alias nr_moneyprefix_refresh  refresh  unless $@
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(*args)
    nr_moneyprefix_refresh(*args)
    self.contents.font.color = normal_color
    draw_gold($game_party.gold, 4, 0, 120)
  end
end



#==============================================================================
# ** Window_ShopBuy
#------------------------------------------------------------------------------
#  This window displays buyable goods on the shop screen.
#==============================================================================

class Window_ShopBuy
  #--------------------------------------------------------------------------
  # * Alias Methods
  #--------------------------------------------------------------------------
  alias nr_moneyprefix_draw_item  draw_item  unless $@
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index, *args)
    # Run the original draw_item
    nr_moneyprefix_draw_item(index, *args)
    # Get the item, x & y
    item = @data[index]
    x = 4
    y = index * 32
    draw_gold(item.price, x + 240, y, 88)
  end
end



#==============================================================================
# ** Window_ShopNumber
#------------------------------------------------------------------------------
#  This window is for inputting quantity of items to buy or sell on the
#  shop screen.
#==============================================================================

class Window_ShopNumber
  #--------------------------------------------------------------------------
  # * Alias Methods
  #--------------------------------------------------------------------------
  alias nr_moneyprefix_refresh  refresh  unless $@
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(*args)
    nr_moneyprefix_refresh(*args)
    self.contents.font.color = normal_color
    draw_gold(@price * @number, 4, 160, 328)
  end
end



#==============================================================================
# ** Window_BattleResult
#------------------------------------------------------------------------------
#  This window displays amount of gold and EXP acquired at the end of a battle.
#==============================================================================

class Window_BattleResult
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    x = 4
    self.contents.font.color = normal_color
    cx = contents.text_size(@exp.to_s).width
    self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
    x += cx + 4
    self.contents.font.color = system_color
    cx = contents.text_size("EXP").width
    self.contents.draw_text(x, 0, 64, 32, "EXP")
    x += cx + 16
    self.contents.font.color = normal_color
    draw_gold(@gold, x, 0, 128)
    y = 32
    for item in @treasures
      draw_item_name(item, 4, y)
      y += 32
    end
  end
end



#==============================================================================
# ** End of Script.
#==============================================================================


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
Wonderjosh
post Feb 19 2012, 08:00 AM
Post #9


Level 3
Group Icon

Group: Member
Posts: 33
Type: Artist
RM Skill: Undisclosed




Hot damn, that is a beautiful sight! You sir, are a gentleman and a scholar. Thank you very much! Works like a charm! Makes me jealous of people with scripting talents haha wink.gif
Go to the top of the page
 
+Quote Post
   
Wonderjosh
post Feb 21 2012, 09:41 AM
Post #10


Level 3
Group Icon

Group: Member
Posts: 33
Type: Artist
RM Skill: Undisclosed




It's been a few days so hopefully I'm ok double-posting (sorry if it's not) but I just noticed that at the end of battle when the battle result window pops up, the gold amount shown is the party's total gold and not the gold received from the battle.

EDIT: Wait! I think I fixed it. I changed this line:

CODE
draw_gold(@$game_party.gold, x, 0, 128)


to this:

CODE
draw_gold(@gold.to_s, x, 0, 128)


in the battle results section. Just looked at the default battle results script and made the change. Is this right? I won't run into any errors along the way? Haha

This post has been edited by Wonderjosh: Feb 21 2012, 09:43 AM
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Feb 22 2012, 04:50 AM
Post #11


Level 50
Group Icon

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed




You're a more observant man than I am happy.gif

You're right about the @gold, you don't need the .to_s to convert the gold integer to a string, my code takes care of that automatically, but it won't hurt if you add it smile.gif

I've edited post #8 so the code has your fix, for future generations that are looking for something similar smile.gif


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
Wonderjosh
post Feb 22 2012, 12:44 PM
Post #12


Level 3
Group Icon

Group: Member
Posts: 33
Type: Artist
RM Skill: Undisclosed




QUOTE (Night_Runner @ Feb 22 2012, 06:50 AM) *
You're a more observant man than I am happy.gif

You're right about the @gold, you don't need the .to_s to convert the gold integer to a string, my code takes care of that automatically, but it won't hurt if you add it smile.gif

I've edited post #8 so the code has your fix, for future generations that are looking for something similar smile.gif


Right on! Haha and well I noticed it since I have a map where I test a bunch of things out before really implementing them and I had a test treasure chest that gave me $900,000, so when I saw that at the end of a battle (when the enemy only give me like $150) I knew something was off, haha.

And posterity, yes! This should help out others who want the same effect in their game. *High five.* Consider this thread solved for reals.
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 21st May 2013 - 11:57 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker