how to make shortened numbers

Started by a23709g3 on

Topic category: Help with modding (Java Edition)

Last seen on 08:15, 27. Apr 2024
Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how to make shortened numbers

how to make number shortened in text? (for example. 428.142 is 428.1K, 72.465.981 is 72.4M)?

Last seen on 16:14, 26. Mar 2024
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Take your string and convert…
Sat, 03/23/2024 - 09:21

Take your string and convert it to a integer via 'Number from text' procedure block in the Math Menu. 

Take the integer and use if statements to determine the multiple, i.e. <=1000, <=1000000, etc. 

Divide the integer by the passing multiple from the if statement and then plug it into a rounding function to make the integer a whole value. 

You can then re-create the string using 'create text with' procedure block, from the text menu, by using the integer and a string to represent the multiple. i.e "M", "K", etc.

Hope this makes sense. You'd need to adjust it to better suit your needs though. I would send an image but I haven't figured out how to attach one yet.