convert a number to a $ value, with $ formatting.

0 favourites
  • 3 posts
From the Asset Store
Jump on numbers in the proper order and reach the sun!
  • So when a number is at 10000 it shows as 10,000

    and to take it further how do I show 10m 490k 17b etc. for millions thousands billions and others beyond?

    1t 017b 890m 742k for example

    I know there are lots of long tedious solutions but Im more wondering if construct has something built in to help simplify this- and if not, maybe it should have an option to do so? Im assuming this is a pretty common thing for games to need-

    Attached is a simple game Im working on- right now the money is just some large un-formatted number and Id like to be able to make it more readable.

    (Image upload seams to be buggy... not attaching it after its uploaded)

  • My example is little bit clumsy but I think it could adapt your idea:

    drive.google.com/open

    Cheers.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So when a number is at 10000 it shows as 10,000

    and to take it further how do I show 10m 490k 17b etc. for millions thousands billions and others beyond?

    1t 017b 890m 742k for example

    What i usually prefer to do is create a conversion system so any number that is between a value is converted to my custom show needs for example:

    Compare variable Coins > 10^3 < 10^6 = set text to Coins/10^3 &"K $"

    Compare variable Coins >= 10^6 < 10^9 = set text to Coins/10^6 &"Mil $"

    Compare variable Coins >= 10^9 < 10^12 = set text to Coins/10^9 &"Bil $"

    Compare variable Coins >= 10^12 < 10^15 = set text to Coins/10^12 &"Tril $"

    And so on.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)