Results 1 to 4 of 4

Thread: Disable scientific notation

  1. #1
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts

    Disable scientific notation

    Hi,

    Search for 1e+0 or scientific notation returned no results.

    What I need is simple - disable scientific notation. As you can see, the value of 1000000 in the top right hud is being displayed in scientific notation as 1e+006.

    Click image for larger version. 

Name:	shot0006.jpg 
Views:	52 
Size:	143.3 KB 
ID:	808

    That just doesn't look good.

    These are the values I'm using in this case:
    PHP Code:
    self.rank 6;
    level.rankpoints[7] = 1000000;
    self.nextrankpoints level.rankpoints[self.rank 1]; 
    and this is the code for the hud:
    PHP Code:
        if(isdefined(self.hud_maxxp))
            
    self.hud_maxxp destroy();

        
    self.hud_maxxp newClientHudElem(self);
        
    self.hud_maxxp.= -62;
        
    self.hud_maxxp.15;
        
    self.hud_maxxp.alignx "left";
        
    self.hud_maxxp.aligny "middle";
        
    self.hud_maxxp.horzAlign "right";
        
    self.hud_maxxp.vertAlign "top";
        
    self.hud_maxxp.fontScale 1;
        
    self.hud_maxxp.label = (&"MP_SLASH");
        
    self.hud_maxxp setValue(self.nextrankpoints);
        
    self.hud_maxxp.sort 9971
    Thanks in advance.


    P.S. Coronel is not a typo, it's portuguese for Colonel.
    Last edited by guiismiti; 7th December 2014 at 04:46.
    set logfile 2

  2. #2
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    the only thing that comes into my mind is: if this hud is static (no fade, move, scale) use a menu + client cvar

  3. #3
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    I'm thinking about converting this hud into a text hud, but it's a workaround... not the best option.
    set logfile 2

  4. #4
    Private
    Join Date
    May 2013
    Posts
    27
    Thanks
    0
    Thanked 19 Times in 11 Posts
    If a simple int(x) doesn't do the trick, you can try to convert it using this function:

    PHP Code:
    roundDecimal(fdecimals)
    {
        if(!
    isDefined(decimals)) decimals 1;
        
    whole int(f);
        switch(
    decimals)
        {
            case 
    5fraction = (int(100000 * (whole) + 0.5)) / 100000; break; // 5 decimals
            
    case 4fraction = (int(10000 * (whole) + 0.5)) / 10000; break; // 4 decimals
            
    case 3fraction = (int(1000 * (whole) + 0.5)) / 1000; break; // 3 decimals
            
    case 2fraction = (int(100 * (whole) + 0.5)) / 100; break; // 2 decimals
            
    default: fraction = (int(10 * (whole) + 0.5)) / 10// 1 decimal
        
    }
        return(
    whole fraction);


  5. The Following 2 Users Say Thank You to PatmanSan For This Useful Post:

    guiismiti (7th December 2014),serthy (7th December 2014)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •