New currencies?

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

User avatar
kamnet
Moderator
Moderator
Posts: 8532
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

New currencies?

Post by kamnet »

Is it possible to code new currencies via either NFO or NML? I can't seem to find any references.
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

Re: New currencies?

Post by Sylf »

Are you trying to do something that you can't do with the "Custom" option for currency?
User avatar
kamnet
Moderator
Moderator
Posts: 8532
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: New currencies?

Post by kamnet »

I'd like to have new currencies with new symbols that I create.
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

Re: New currencies?

Post by Sylf »

The currency symbol needs to be a part of Unicode character set (like how Indian rupee symbol was added as recent as August of 2010), or you'll have to use a shorthand for your currency, such as USD, GBP etc.
You should be able to do everything else through the custom currency setting.
User avatar
kamnet
Moderator
Moderator
Posts: 8532
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: New currencies?

Post by kamnet »

Custom currency setting doesn't help me release a NewGRF, though. ;)
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: New currencies?

Post by frosch »

What you can do:
Write a NFO grf
* Define a sprite font glyph in the unicode private area (towards the end, because in the beginning are already trains symbols and stuff).
* Use Action 0 feature 8 (https://newgrf-specs.tt-wiki.net/wiki/A ... l_Settings) to define a custom currency.
* While I am not aware of anyone every using this, since it is pretty useless compared to the in-game custom currency option, for some reason it is even implemented in OTTD. But apparently NewGRF currency take precedence over any GUI setting.
* In any case it won't look that good, if you are using a truetype font otherwise. Since your currency symbol will not scale.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
User avatar
Awesometrains
Traffic Manager
Traffic Manager
Posts: 129
Joined: 22 Nov 2015 17:07

Re: New currencies?

Post by Awesometrains »

Before you do that , figure out why Euros are disabled in OpenTTD
Qa'pla!
User avatar
kamnet
Moderator
Moderator
Posts: 8532
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: New currencies?

Post by kamnet »

Awesometrains wrote:Before you do that , figure out why Euros are disabled in OpenTTD
They're not, you just have to enable them in Settings.
Baldy's Boss
Tycoon
Tycoon
Posts: 1396
Joined: 23 Feb 2014 22:02

Re: New currencies?

Post by Baldy's Boss »

Are there currencies worth more than the GBP currently possible?
User avatar
kamnet
Moderator
Moderator
Posts: 8532
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: New currencies?

Post by kamnet »

Baldy's Boss wrote:Are there currencies worth more than the GBP currently possible?
According to Action 0, Property 0B, yes. Unfortunately it doesn't look like this is implemented into OpenTTD custom currency option itself, it's only available via NewGRF.

Which is fine, since I actually do have some currencies in mind where they are worth more than GBP.
Baldy's Boss
Tycoon
Tycoon
Posts: 1396
Joined: 23 Feb 2014 22:02

Re: New currencies?

Post by Baldy's Boss »

Any plans to work the higher-value option into trunk?
If not,why not?
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

Re: New currencies?

Post by Sylf »

Baldy's Boss wrote:Any plans to work the higher-value option into trunk?
If not,why not?
That's a topic for OpenTTD Development or OpenTTD Suggestions forum, as it has nothing to do with NewGRF. Maybe a moderator can split the topic and move the new thread there.
User avatar
kamnet
Moderator
Moderator
Posts: 8532
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: New currencies?

Post by kamnet »

Baldy's Boss wrote:Any plans to work the higher-value option into trunk? If not,why not?
I suppose that if that's what the devs wanted to do, they just would have done it years ago rather than put it into the NewGRF spec.
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: New currencies?

Post by frosch »

Before you get too excited, you should test how much of the NewGRF currency stuff actually works.
I am quite sure that noone tested it ever.

I can already tell you that fractional conversion rates with £ won't work. The fractional part is already dropped when loading the NewGRF.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
User avatar
Awesometrains
Traffic Manager
Traffic Manager
Posts: 129
Joined: 22 Nov 2015 17:07

Re: New currencies?

Post by Awesometrains »

kamnet wrote:
Baldy's Boss wrote:Are there currencies worth more than the GBP currently possible?
According to Action 0, Property 0B, yes. Unfortunately it doesn't look like this is implemented into OpenTTD custom currency option itself, it's only available via NewGRF.

Which is fine, since I actually do have some currencies in mind where they are worth more than GBP.
in game , dollar and euro both have twice HALF as much value as pounds
Last edited by Awesometrains on 13 Feb 2016 18:39, edited 1 time in total.
Qa'pla!
Supercheese
Tycoon
Tycoon
Posts: 1660
Joined: 16 Dec 2007 22:24
Location: Idaho, USA

Re: New currencies?

Post by Supercheese »

Awesometrains wrote:in game , dollar and euro both have twice as much value as pouns
Strike that; reverse it. :wink:
Eyecandy Road Vehicles | Fake Subways | Supercheese's NewObjects

"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton
User avatar
kamnet
Moderator
Moderator
Posts: 8532
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: New currencies?

Post by kamnet »

Finally picking this back again... good grief I've forgotten all the NFO I barely knew!

Here's just a small sampling, trying to set up my file and just provide a new currency name. Grfcodec hangs trying to compile. Where'd I screw up? :)
// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
0 * 4 0A 00 00 00
1 * 110 08 06 "KF" 09 01 "Simoleon Currency" 00 "Custom currency based on the video games SimCity and The Sims. Code by Kevin Fields (kamnet)." 00
2 * 6 00 08 0A 00 00 "Simoleons"
User avatar
PaulC
Director
Director
Posts: 616
Joined: 31 Jul 2006 12:40
Location: Lancs, England
Contact:

Re: New currencies?

Post by PaulC »

kamnet wrote:Where'd I screw up?
You need to define the currency text with an action 4, which should look like this:

Code: Select all

-1 * 0	 04 48 FF 01 00 DC "Simoleans" 00
Also, your action 0 is missing a few elements; <num-props> (01, since you only want to change 1 property), <num-info> (01, since you want to change the properties of 1 currency), and <id> which is the id of the currency you want to modify/overwrite. The id can be any value between 00 and 21 (hex), but for the sake of this example let's say 04 which will replace Japanese Yen. Property 0A refers to the above action 4, so your action 0 will look like this:

Code: Select all

-1 * 0	 00 08 01 01 04 0A 00 DC
That should do what you're trying to do.
frosch wrote:Before you get too excited, you should test how much of the NewGRF currency stuff actually works.
Good call. I coded a few currency grfs for TTDP many years ago, and though they do work in OTTD (at least ostensibly) I thought I'd have a proper look to see what they're doing.

Biggest problem is that property 0B (currency multiplier) doesn't seem to work properly. Setting this property to FF FF FF FF (the largest possible value) should in theory give a multiplier of £1 x 4,294,967.295; this works exactly so in TTDP, but in OTTD the result is actually £1 x 35,127 which is significantly lower. This wouldn't be so bad if OTTD was scaling these figures or if there was some logic to them, but my tests have been somewhat erratic. For example, setting property 0B to 55 55 55 55 gives a higher multiplier of £1 x 55,399! Unless I can establish a pattern or at least nail down some usable values this looks pretty broken to me.

I can confirm that multipliers lower than 1 won't work in OTTD. Setting property 0B to 01 00 00 00 (the lowest possible value) should result in a multiplier of £1 x 0.001; again, this works fine in TTDP, but in OTTD any multiplier lower than 1 will just make the value of everything appear as zero, which isn't helpful.
User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 721
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Re: New currencies?

Post by Gwyd »

Hang on, are you saying a multiplyer of less than one makes everything cost 0? I can see a use for this.

Sent from my SM-G935F using Tapatalk
agentw4b
Traffic Manager
Traffic Manager
Posts: 215
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: New currencies?

Post by agentw4b »

Create a bitcoin :-)
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 6 guests