casper667

csca
CSCA Currency System

32 posts in this topic

CSCA Currency System

By: Casper Gaming (Casper667)
Last Update: March 15, 2013
Latest version: 1.0.3

Introduction

Allows you to easily create any number of different currencies. Many customizable options, such as an icon and color for each currency, as well as the max and starting amount of that currency. Because this script heavily modifies the way the default gold is handled, it likely will not be completely compatible with scripts that do anything money related unless they provide a patch for this script.

 

Screenshots
Inside the new item: a money pouch for all your currencies!
cspouch.png
You can also change the current currency in use through the money pouch:
cspouchchange.png
The gold window also shows icon and color now:
csmenuk.png

Shops can sell items of all currencies:

csshop.png

Or you can force shops to use just 1 currency (values are automatically calculated for the new currency from the items base currency):

csshopsamecur.png


How to Use
Place in your materials section. Setup required. Instructions in script.

Script
Text file is found here(copy and paste everything into your script editor in the materials section): LINK

NOTE! Some CSCA Scripts may not work nicely or at all with this script right now. I will be working on patching them over the next few days/weeks.

 

Updates

version 1.0.1

- Added support for CSCA Extra Stats

 

version 1.0.2

- Fixed bug with the gold window not updating currency when called from message window.

 
version 1.0.3
- Added support for CSCA Difficulty System


Credit
Casper Gaming

Terms
http://www.caspergam...rms_of_use.html

Edited by casper667
Sievn likes this

Share this post


Link to post
Share on other sites

Fantastic! This is exactly what i've been looking for! Thanks!

 

However, I get a "Can't convert symbol into integer" error when I try to go to shop or when I win a battle.

In a shop, the error points to line 641:

color = get_currency_used(item)[:color]

After battle the line is 185:

text = sprintf(Vocab::ObtainGold, amount, currency[:name])

 

I've set up two currencies:

- For index [0] the symbol is :cr

- For index [1] the symbol is :cm

 

Notetag for enemies:

<csca_currency: :cm>

 

Notetag for items:

<csca_currency: :cr>

 

In the shop event, before the actual shop processing, I have the following commands:

ControlVariables: [0021:ForceCurrencyID] = 0

ControlVariables: [0022:ForceCurrencySellID] = 0

ControlVariables: [0023:SellRate%] = 75

 

Am I doing something wrong here?

Did I understand correctly that every item/enemy must have a notetag?

Share this post


Link to post
Share on other sites

@esrann First of all, you don't need the extra : in the notetag (though that shouldn't cause any problems). Also, ForceCurrencyID and ForceCurrencySellID should both be less than 0, otherwise it will force the shop to use index 0 (unless that is the intended results?)


As for the error, you don't seem to be doing anything wrong. Every item and enemy has the currency note tag? The only other thing I could think of is another custom script conflicting with this. Are you using any? If not, could you please PM me a link to download an unencrypted example of the error?

Share this post


Link to post
Share on other sites

Ah, it was the extra colon in front of the currency symbol!

Which means I have to change notetags on every single item & enemy... :P

Everything else is fine and working.

 

Thanks for the reply!

Share this post


Link to post
Share on other sites

Edit: No, I was wrong. That was an entirely different shop.

I made a fresh demo with the error and my edits to the script if you'd like to see it for reference.

Edited by VagrantEnchanter

Share this post


Link to post
Share on other sites

I noticed on small detail:

 

When I use the \$ control character in an event message to show the gold window next to the message, the gold window does not obey the 'switch_currency(currency)' script call, but always uses the default currency.

 

Is there a way to fix this?

Share this post


Link to post
Share on other sites

I noticed on small detail:

 

When I use the \$ control character in an event message to show the gold window next to the message, the gold window does not obey the 'switch_currency(currency)' script call, but always uses the default currency.

 

Is there a way to fix this?

Script has been updated to fix this.

Share this post


Link to post
Share on other sites

Script has been updated again! Now it supports CSCA Difficulty System. Make sure the Difficulty System script is ABOVE the Currency System script in the editor or it will error.

Share this post


Link to post
Share on other sites

I think I got "Wrong number of arguments (6 for 5)" when I try to sell an item

 

 

 width = contents_width - 8
    draw_currency_value(@price * @number, @currency_unit, 4, price_y, width, @currency)

Share this post


Link to post
Share on other sites

I could not get it to reproduce your error. Are you using any custom scripts that affect the shop scene or create their own shop scene?

Edited by casper667

Share this post


Link to post
Share on other sites

Um, I might of just missed this but is there a way to turn one currency into another?

 

Example the player has 100 Yen. They talk to an NPC and the NPC converts the yen into 0.77 Euros(or something like that.)

Share this post


Link to post
Share on other sites

Um, I might of just missed this but is there a way to turn one currency into another?

 

Example the player has 100 Yen. They talk to an NPC and the NPC converts the yen into 0.77 Euros(or something like that.)

 
 
# exchange_currency(currency1, currency2, amount)
# Exchanges the [amount] of [currency1] for [currency2]. Takes into consideration
# currency values. For example if 100 of currency 1 (value of 1), for
# currency 2 (value of 2), the result will be 200 of currency 2 gained.

Share this post


Link to post
Share on other sites

I'm getting a "can't convert symbol into color" error.

 

I think it may be conflicting with Tidloc's D-Shop Script, but when I took it out I still got the error. Only other scripts I am using are all CSCA.

Share this post


Link to post
Share on other sites

At what point in the game are you getting the error? Immediately when it starts, or a certain scene?

Edited by casper667

Share this post


Link to post
Share on other sites

I start a new game, get the pouch, go to select a currency, and it gives me the error. Also, when I try to buy at shops. I know my shops are set up correctly, though.

Share this post


Link to post
Share on other sites

No problem. I am using a few more scripts at the moment, but it's the same error I was getting when I only had the 2 before:

946366_10201660680939856_2092417162_n.jp

 

Let me know if you need further information. Thanks!

Share this post


Link to post
Share on other sites

Aya_Vectra

 

I passed a few hours to make many many tests, and I know what the problem is for the buy scene : There is a conflict with the Yanfly Core Engine !

 

 

 

EDIT :

 

Everything's ok, but I have a question : How can you do that the play must pay with a currency, or sell item with an other ?

The variables didn't work for that, and the note in notboxe neither.

 

If you set a currency (gold) a value of 100 and a currency (silver) 50, when you have to pay, you don't pay twice, but you sell twice, and I don't

undertsand.

 

Thanks in advance

Edited by Ewaldar

Share this post


Link to post
Share on other sites

Aya_Vectra

 

I passed a few hours to make many many tests, and I know what the problem is for the buy scene : There is a conflict with the Yanfly Core Engine !

 

 

 

EDIT :

 

Everything's ok, but I have a question : How can you do that the play must pay with a currency, or sell item with an other ?

The variables didn't work for that, and the note in notboxe neither.

 

If you set a currency (gold) a value of 100 and a currency (silver) 50, when you have to pay, you don't pay twice, but you sell twice, and I don't

undertsand.

 

Thanks in advance

I'm not quite sure I understand your problem... Could you show pictures of the problem?

Share this post


Link to post
Share on other sites

so i keep getting the same error. im not sure what's causing it though.

 

Script 'Currency' Line 312: NoMethodError Occurred.

undefined method `[]' for nil:NilClass

 

can you help me out?

Share this post


Link to post
Share on other sites

I keep getting can't convert fixnum into color

when I use the script call to convert currencies

 

exchange_currency(0, 2, 100)

 

No other scripts are installed

I am pretty sure..

Edited by Sievn

Share this post


Link to post
Share on other sites

I got an error in the shop scene by default (even in a blank project), saying that symbols couldn't be converted to integers. I'm not the greatest scripter, but I was able to fix this by changing the values of modifier(line 640), color(679) and cur_unit(680) to constants, which leads me to believe there's some sort of problem in accessing the symbol values from the currency definition hashes. This is only a temporary solution, of course, since it relies on changing those variables when switching to a new currency, but hopefully this will help you fix whatever bug is present in that code.
EDIT: I made more progress in letting shop currencies switch by replacing references to an item's currency symbol with $game_party.current_currency[:symbol] for each :color, :amount, etc. but the problem of switching currencies effectively still remains since an item's currency is replaced by whatever the party has selected through the money pouch.

Edited by futrchamp

Share this post


Link to post
Share on other sites

futrchamp Could you post the entire error message? Our line numbers are likely different if you've made any changes at all to the script.

 

Sievn the exchange currencies script call does not have anything to do with color... Are you getting the error later in the game or right when you make the script call?

Edited by casper667

Share this post


Link to post
Share on other sites

What exactly am i doing wrong?  I cant open a shop without crashing and getting an error.

 

 

 

Script 'csca currency' line 637: TypeError occured.

 

can't convert Symbol into Integer

 

 

ive given all the items/armors/weapons

<csca_currency: G>
<csca moneypouch>

What am i doing wrong?  Did you add a custom shop scene?

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.