Advertisement
lennonluiz0907

My Short Number Script for Idle Game Maker - Different Ver.

Aug 15th, 2014
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. nums = ['k', 'M', 'B', 'T', 'Qu', 'Qi', 'Sx', 'Sp', 'O', 'N', 'D', 'UD', 'DD', 'TD', 'QuD', 'QiD', 'SxD', 'SpD', 'OD', 'ND', 'V', 'UV', 'DV', 'TV', 'QuV', 'QiV', 'SxV', 'SpV', 'OV', 'NV', 'Tg', 'UTg', 'DTg', 'TTg', 'QuTg', 'QiTg', 'SxTg', 'SpTg', 'OTg', 'NTg', 'Qdr', 'UQdr', 'DQdr', 'TQdr', 'QaQdr', 'QiQdr', 'SxQdr', 'SpQdr', 'OQdr', 'NQdr', 'Qidr'];
  2.  
  3.  
  4. function Beautify(num,floats)
  5. {
  6. if (!isFinite(num)) return 'Infinity'
  7. if(num < 1e3 || num >= parseFloat('1e' + 3*(nums.length))) return Math.round(num)
  8. var i = 0;
  9. while(num >= 1000)
  10. {
  11. num/=1000;
  12. i++;
  13. }
  14. num = Math.round(num*1000)/1000;
  15. if(num>=1000)
  16. {
  17. num/=1000;
  18. i++;
  19. num = Math.round(num*1000)/1000;
  20. } //deals with rounding errors
  21. num = num.toFixed(3);
  22. return num + nums[i - 1]
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement