generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Decimals..

Previous Thread :: Next Thread 
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
10 Jul 2015 10:57 PM
Is it possible to get the numbers over 1k, 10k, 100k, 1M, and so on to have decimals and be coded more efficient instead of 'if value > 1000 then text = "1k"'. Also having decimals as in 1.1k and 101k?
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
10 Jul 2015 11:15 PM
b1
Report Abuse
TheAgonizingGuy is not online. TheAgonizingGuy
Joined: 29 Mar 2013
Total Posts: 4234
10 Jul 2015 11:19 PM
Pretty sure there's an article on the wiki about it
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
10 Jul 2015 11:19 PM
Link please? I'm willing to read through it.
Report Abuse
TheAgonizingGuy is not online. TheAgonizingGuy
Joined: 29 Mar 2013
Total Posts: 4234
10 Jul 2015 11:21 PM
http://wiki.roblox.com/index.php?title=Math

that's the part about math

but just look around

I know there's a way I saw someone do it
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
11 Jul 2015 12:22 AM
Wrote this for you, it should work. Returns a string that formats the number.

http://codepad.org/575Tq82e

~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
11 Jul 2015 12:24 AM
Add a break at the end (but inside of) that for loop, for better efficiency.

So it should be

if num >= 1000*i then
num = num / 1000
suffix = suffixes[i]
break
end

~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
11 Jul 2015 12:27 AM
Hold on that's wrong let me fix it.

~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
11 Jul 2015 12:31 AM
My bad, fixed: http://codepad.org/yUQHewcS

~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
11 Jul 2015 12:32 AM
Fourth times the charm: http://codepad.org/jZJFdCAC

~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image