Page 1 of 2

New currencies?

Posted: 24 Jan 2016 16:12
by kamnet
Is it possible to code new currencies via either NFO or NML? I can't seem to find any references.

Re: New currencies?

Posted: 24 Jan 2016 20:11
by Sylf
Are you trying to do something that you can't do with the "Custom" option for currency?

Re: New currencies?

Posted: 24 Jan 2016 21:40
by kamnet
I'd like to have new currencies with new symbols that I create.

Re: New currencies?

Posted: 26 Jan 2016 00:35
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.

Re: New currencies?

Posted: 26 Jan 2016 12:36
by kamnet
Custom currency setting doesn't help me release a NewGRF, though. ;)

Re: New currencies?

Posted: 26 Jan 2016 18:37
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.

Re: New currencies?

Posted: 31 Jan 2016 15:03
by Awesometrains
Before you do that , figure out why Euros are disabled in OpenTTD

Re: New currencies?

Posted: 31 Jan 2016 18:29
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.

Re: New currencies?

Posted: 31 Jan 2016 23:16
by Baldy's Boss
Are there currencies worth more than the GBP currently possible?

Re: New currencies?

Posted: 01 Feb 2016 01:02
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.

Re: New currencies?

Posted: 03 Feb 2016 07:45
by Baldy's Boss
Any plans to work the higher-value option into trunk?
If not,why not?

Re: New currencies?

Posted: 03 Feb 2016 15:23
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.

Re: New currencies?

Posted: 03 Feb 2016 17:05
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.

Re: New currencies?

Posted: 03 Feb 2016 19:05
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.

Re: New currencies?

Posted: 11 Feb 2016 01:49
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

Re: New currencies?

Posted: 11 Feb 2016 04:58
by Supercheese
Awesometrains wrote:in game , dollar and euro both have twice as much value as pouns
Strike that; reverse it. :wink:

Re: New currencies?

Posted: 26 Jul 2017 09:54
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"

Re: New currencies?

Posted: 25 Jan 2018 23:07
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.

Re: New currencies?

Posted: 26 Jan 2018 06:49
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

Re: New currencies?

Posted: 26 Jan 2018 15:04
by agentw4b
Create a bitcoin :-)