|
| 13 Jul 2016 08:30 PM |
One that is like this:
1k, 2.45M, 3.46B, etc
How hard would that be? And what would I have to use to make it? |
|
|
| Report Abuse |
|
|
Shiro75
|
  |
| Joined: 18 Jan 2010 |
| Total Posts: 587 |
|
|
| 13 Jul 2016 08:34 PM |
| By "1k, 2.45M, 3.46B, etc" do you mean that the script uses letters like k, M, and B to shorten big numbers? |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2016 08:34 PM |
'By "1k, 2.45M, 3.46B, etc" do you mean that the script uses letters like k, M, and B to shorten big numbers?'
Yes |
|
|
| Report Abuse |
|
|
| |
|
Shiro75
|
  |
| Joined: 18 Jan 2010 |
| Total Posts: 587 |
|
|
| 13 Jul 2016 08:44 PM |
I don't think that would be to difficult.
Everytime the money changes, you could probably just find the length and use conditions that explicitly state the minimum length of each thousand, million, etc. Check the length in the order from the largest category to the least.
something like..
local money = tostring(money.Value) local length = string.len(money) if length >= 13 then print(string.sub(money, 1, 3) .. "B") -- http://wiki.roblox.com/index.php?title=Function_dump/String_manipulation#string.sub elseif length >= 10 then |
|
|
| Report Abuse |
|
|
Shiro75
|
  |
| Joined: 18 Jan 2010 |
| Total Posts: 587 |
|
|
| 13 Jul 2016 08:46 PM |
I'm sorry, that was just a bit of a quick outline.
print(string.sub(money, 1, 3) .. "B")
That part is problematic though, but you could find a way around that by adding more conditions after its category is determined. |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 06:47 PM |
Bump. I tried your method and it doesn't work past length > 14 due to number limits.
Any other methods would be appreciated. |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Jul 2016 06:57 PM |
Don't use actual numbers with your money them, store them as 1.2B and so on in the beginning, then when buying things, you can use your code to subtract .1B respectively.
#code print("while false do end") |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 06:58 PM |
'Don't use actual numbers with your money them, store them as 1.2B and so on in the beginning, then when buying things, you can use your code to subtract .1B respectively.'
Explain, please. Would I use tostring() and tonumber()? |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 07:02 PM |
I'm terrible with math, but if your numbers are getting too large for ROBLOX to handle, I'm saying you could try this:
local money = "1K" local current = "K"
local money = tostring(tonumber(money:sub(1,1)) + 1).."K" --This now equals 2K
if current == "K" then --Buying in the thousands range local thousands = tonumber(money:sub(1, (#money - 1))) if (thousands > 2.1) then thousands = (thousands - 2.1) money = tostring(thousands).."K" end end
They obviously only have 2K, not 2.1K (enough to buy whatever) but that's just an inefficient example of how to get around the maximum number problem.
#code print("while false do end") |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 07:03 PM |
| use multiple number values.For example if you have 1000.make it so it changes to 0 and stores it at 1 on another number value called thousands for example. |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 07:08 PM |
'use multiple number values.For example if you have 1000.make it so it changes to 0 and stores it at 1 on another number value called thousands for example.'
Example of this being used? Would I do this:
k = 0
if money > 1000 then k = k + 1 money = 0 end |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Jul 2016 07:18 PM |
@OP
I know the example I provided was weak, but if you set it up with some string patterns and make a prebuilt lib with all your functions for it pre-made, it would work well.
#code print("while false do end") |
|
|
| Report Abuse |
|
|