Page 7 of 9 FirstFirst ... 56789 LastLast
Results 121 to 140 of 176
  1. #121

    Re: Sig coding: Collection of useful functions

    Cool (although your animated GIF seems to be dead today). What did you use to make the gif?
    Sorry if this is the wrong thread for this discussion, but it started here.

  2. #122
    New User
    Join Date
    2012-01-30
    Location
    Thuringia / Germany
    Posts
    8

    Re: Sig coding: Collection of useful functions

    haha great signature... want to see more...

  3. #123
    New User
    Join Date
    2012-02-07
    Posts
    4

    Re: Sig coding: Collection of useful functions

    Thanks

    It's too big though. I was already asked to remove it from one forum. The gif is over 1MB and the png is 150kb. It's ok, I was just playing around and trying to be creative .

    I used:
    - Youtube Downloader - to get the videos
    - 1001freefonts.com - to get the font
    - Photoshop - to design the sig
    - Adobe After Effects - to cut and edit the videos and add animation
    - Adobe Premiere Pro - to export all frames as stills
    - Photoshop - to put the stills together and export as animated gif (Premiere Pro exports animated gifs poorly)
    - and of course bf3stats.com to do the PNG (i just copied chunks of code I needed from different sigs available on the site)

    I will make something smaller though, over 1MB is too much for forums.

  4. #124
    PHP Developer
    Join Date
    2011-11-21
    Location
    Amsterdam, The Netherlands
    Posts
    279
    BF3 PC
    Grezvany13
    Gamer IDs

    XFIRE ID: Grezvany13 Steam ID: Grezvany13

    Re: Sig coding: Collection of useful functions

    Actually, you can import movies directly in Photoshop although cutting and editing is not possible (and not all formats are supported). So no need to create stills before importing

    And you can create an animation easily under 1MB; here's something I made some time ago:



    Small tip when you save your video; remove all sound, crop/resize to the needed size, set the FPS to 12 (you can do 24, but filesize is 3x larger) and save it with websafe (256) colors. This way the import goes faster and it's easier to see if anything goes wrong (eg colors, speed, etc).
    Member of [DD] DoubleDutchClan - Largest Dutch Multi Gaming Community Since 2007



    Proud developer of: BF3Stats API Class - A simple PHP Framework for your own projects

  5. #125
    New User
    Join Date
    2012-02-07
    Posts
    4

    Re: Sig coding: Collection of useful functions

    Thanks for the tips but I already considered all that (removed sound, created it in desired dimensions, 256 colors). The video I made was created in After Effects and could not be imported to Photoshop straight from there. Had to be done via Premiere. Besides, importing it to Photoshop as video would loose quality (unless I made it some super losless high quality video but that still caused some quality loss on the final gif). Exporting as stills gave me the optimal quality in Photoshop and from there I could play around with export settings. And I know that I can create animation under 1MB. I just wanted to keep it high quality so there wouldn't be much difference between the gif and png. Plus, my gif is 500 frames and 1MB, yours is 100 frames and 600kb .

    I'll create a new, smaller one soon but I'll post it in a separate thread as we went off topic here (sorry for that).

  6. #126
    New User
    Join Date
    2012-02-10
    Posts
    2
    BFBC2 PS3
    tastyfish
    BF3 PS3
    tastyfish

    Re: Sig coding: Collection of useful functions

    I am pretty sure this data is not yet available through the API. I would like to display the set of dogtags that I chose for my soldier. Not the dogtags taken list, but the left and right tags other people see when I kill them or they take my tags. Is that something that could be provided in the future?

  7. #127
    New User
    Join Date
    2012-02-17
    Posts
    3

    Re: Sig coding: Collection of useful functions

    Good morning.

    A small application code. Making of cutters went crazy and playing very often with my colleagues, I will wish to add a list of my colleagues with the number of faith that I have cut. A bit like on http://bf3stats.com/stats_pc/ [player] / dogtags. 6 colleagues has listing

  8. #128
    New User
    Join Date
    2012-02-17
    Posts
    3

    Re: Sig coding: Collection of useful functions

    re

    It's me again. There is no way I can not understand or even have a track. Parcontre to help people that they may be able interresser, I think, to support the above.
    http://files.bf3stats.com/js/bf3dogtags.js

    thank you

  9. #129

    Re: Sig coding: Collection of useful functions

    is the a simple way to get total pistol kills? I've tried to get it a few ways but I'm not very good at this.

    EDIT: I made a simple code for this just by adding up all the pistol kills, crude but it gets the job done. Only problem with it is that it's faulty if you have zero kills with one of them.
    Last edited by TxO-BuzzKill; 2012-02-23 at 21:29.

  10. #130
    New User
    Join Date
    2011-11-20
    Posts
    8

    Re: Sig coding: Collection of useful functions

    Hey Everyone,

    Was just curious is it possible to code teamkills into a sig, been browsing through the example code but couldn see anything. All help greatly appreciated Thanks and keep up the good work everyone.

  11. #131
    DWRnNyTeMaRe
    Join Date
    2012-02-29
    Posts
    3

    Re: Sig coding: Collection of useful functions

    I am trying to code in rankings but I cant find any coding information on it or even figure out where to start with self coding it.

    I am wanting to code in my headshot distance rank and Percentile
    Last edited by NyTeMaRe; 2012-02-29 at 19:19. Reason: adding info


  12. #132

    Re: Sig coding: Collection of useful functions

    I don't think all the rankings are available through the signature functions, I think it is only available in the API. Someone correct me if I am wrong.

  13. #133

    Re: Sig coding: Collection of useful functions

    CanOWupAss,
    I modded your code to fix the stars for vehicles. tested good for tanks, jets, scout helicopter, attack helicopter, and IFV.
    Code:
    // get vehicle list sorted by kills
    var bestweaps=getSortedList(p.stats.vehicles,'time');
    pcount=0;
    wcount=0;
    weapy=statsy+40;
    for (n in bestweaps) {
      wcount++;
      rectangle({x:statsx-5, y:weapy-12, w:135, h:54, fill:'dddddd-90'});
      image({x:statsx, y:weapy, file:bestweaps[n].img, w:74, h:45});
      wtext='';
      wtext=bestweaps[n].name;
      invshadowtext({x:statsx, y:weapy, size:fontsize, text:wtext});
      wtext=nf(bestweaps[n].time/60,1) + ' mins';
      text({x:statsx+129, y:weapy+10, size:fontsize-1, text:wtext, align:'right'});
           wtext=bestweaps[n].kills + ' kills';
           text({x:statsx+129, y:weapy+19, size:fontsize-1, text:wtext, align:'right', color:'444444'});
    starimg = image({x:statsx+90, y:123, file:'0oyOSoWSn17DvBnh9y/servicestar-62x31.png', w:38, h:20});
    if (bestweaps[n].type =='vAA') {
    text({text:(((p.stats.scores.vehicleaa)-
    (p.stats.scores.vehicleaa%32000))/32000)+' ', 
    font:'0osNfce0H0eqnM4gmh/play-regular-webfont.ttf', x:starimg.x+34, y:starimg.y+14,  align: 'right', color:'ffffff', size:7});}
    
    if (bestweaps[n].type =='vAH') {
    text({text:(((p.stats.scores.vehicleah)-
    (p.stats.scores.vehicleah%60000))/60000)+' ', 
    font:'0osNfce0H0eqnM4gmh/play-regular-webfont.ttf', x:starimg.x+34, y:starimg.y+14,  align: 'right', color:'ffffff', size:7});}
    
    if (bestweaps[n].type =='vMBT') {
    text({text:(((p.stats.scores.vehiclembt)-
    (p.stats.scores.vehiclembt%100000))/100000)+' ', 
    font:'0osNfce0H0eqnM4gmh/play-regular-webfont.ttf', x:starimg.x+34, y:starimg.y+14,  align: 'right', color:'ffffff', size:7});}
    
    if (bestweaps[n].type =='vIFV') {
    text({text:(((p.stats.scores.vehicleifv)-
    (p.stats.scores.vehicleifv%90000))/90000)+' ', 
    font:'0osNfce0H0eqnM4gmh/play-regular-webfont.ttf', x:starimg.x+34, y:starimg.y+14,  align: 'right', color:'ffffff', size:7});}
    
    if (bestweaps[n].type =='vJA') {
    text({text:(((p.stats.scores.vehiclejet)-
    (p.stats.scores.vehiclejet%35000))/35000)+' ', 
    font:'0osNfce0H0eqnM4gmh/play-regular-webfont.ttf', x:starimg.x+34, y:starimg.y+14,  align: 'right', color:'ffffff', size:7});}
    
    if (bestweaps[n].type =='vJF') {
    text({text:(((p.stats.scores.vehiclejet)-
    (p.stats.scores.vehiclejet%35000))/35000)+' ', 
    font:'0osNfce0H0eqnM4gmh/play-regular-webfont.ttf', x:starimg.x+34, y:starimg.y+14,  align: 'right', color:'ffffff', size:7});}
    
    if (bestweaps[n].type =='vSH') {
    text({text:(((p.stats.scores.vehiclesh)-
    (p.stats.scores.vehiclesh%48000))/48000)+' ', 
    font:'0osNfce0H0eqnM4gmh/play-regular-webfont.ttf', x:starimg.x+34, y:starimg.y+14,  align: 'right', color:'ffffff', size:7});}
    
      break;
    Last edited by gprovostjr; 2012-03-18 at 04:46.

  14. #134

    Re: Sig coding: Collection of useful functions

    Looks good. Took what you had and modified it to fit mine. You would see it in my signature but I am crap with vehicles. Thanks.

  15. #135

    Re: Sig coding: Collection of useful functions

    Quote Originally Posted by CanOWupAss View Post
    Looks good. Took what you had and modified it to fit mine. You would see it in my signature but I am crap with vehicles. Thanks.
    LOL glad you like it. I also modified the favclass to include T-UGS for Recon, code is.

    Code:
    //favkit='Assault';
    if (favkit=='Assault') {
      soldierx = -5;
      soldiery = 0;
      soldierh = 250;
      soldierw = 220;
      namecolor = '904d4d';
      xloc = xloc+10;
      rankx = 115; 
      ranky = 44;
      statsx = 170;
      maxmedals=12;
      image1 = '0oyOSoWSn17DvBnh9y/battlefield-3-defib.png';
      image2 = '0oyOSoWSn17DvBnh9y/battlefield-3-medkit.png';
      image3 = '';
      ci1x = 165; ci1y = 50; ci1h = 50; ci1w = 50;
      ci1text = p.stats.global.revives + ' revives' ;
      ci2x = 165; ci2y = 115; ci2h = 50; ci2w = 50;
      ci2text = p.stats.global.heals + ' heals';
      ci3x = 165; ci3y = 50; ci3h = 50; ci3w = 50;
      ci3text = '';}
    if (favkit=='Recon') {
      soldierx = -30;
      soldiery = -7;
      soldierh = 257;
      soldierw = 240;
      namecolor = '424242';
      xloc = 110; 
      rankx = 150; 
      ranky = 60;
      statsx = xloc+30;
      maxmedals = 14;
      image1 = '0oyOSoWSn17DvBnh9y/battlefield-3-radio-beacon.png';
      image2 = '0oBB8yOn10mC4sTIgd/MAV.png';
      image3 = '0oBB8yOn10mC4sTIgd/468px-Tugs.png';
      ci1x = 133; ci1y = 140; ci1h = 50; ci1w = 50;
      ci1text = p.stats.equipment.seqRad.spawns + ' spawns' ;
      ci2x = 150; ci2y = 50; ci2h = 50; ci2w = 50;
      ci2text = p.stats.equipment.seqMAV.spots + ' spots';
      ci3x = 180; ci3y = 90; ci3h = 50; ci3w = 50;
      ci3text = p.stats.equipment.seqUGS.spots + ' spots' ;}
    if (favkit=='Engineer') {
      soldierx = -20;
      soldiery = -10;
      soldierh = 260;
      soldierw = 230;
      namecolor = '8d8674';
      xloc = xloc-8; 
      rankx = 115; 
      ranky = 45;
      statsx=180;
      maxmedals = 12;
      image1 = '0oyOSoWSn17DvBnh9y/RepairTool.png';
      image2 = '';
      image3 = '';
      ci1x = 190; ci1y = 70; ci1h = 100; ci1w = 25;
      ci1text = p.stats.global.repairs + ' repairs' ;
      ci2x = 165; ci2y = 50; ci2h = 50; ci2w = 50;
      ci2text = '';
      ci3x = 165; ci3y = 50; ci3h = 50; ci3w = 50;
      ci3text = '';}
    if (favkit=='Support') {
      soldierx = 7;
      soldiery = -8;
      soldierh = 258;
      soldierw = 230;
      namecolor = '5b5342';
      xloc = xloc+35; 
      rankx = 0; 
      ranky = 45;
      statsx=180;
      maxmedals = 11;
      image1 = '0oyOSoWSn17DvBnh9y/battlefield-3-ammo.png';
      image2 = '0oyOSoWSn17DvBnh9y/battlefield-3-ammo.png';
      image3 = '';
      ci1x = 170; ci1y = 47; ci1h = 50; ci1w = 50;
      ci1text = p.stats.global.resupplies+ '' ;
      ci2x = 194; ci2y = 107; ci2h = 0; ci2w = 0;
      ci2text = 'resupplies';
      ci3x = 165; ci3y = 50; ci3h = 50; ci3w = 50;
      ci3text = '';}
    I might have to play around with it again to get it all to fit right

  16. #136

    Re: Sig coding: Collection of useful functions

    If anybody is interested here is a function to trim text to a fixed amount of pixels

    Code:
    var getPixelTrimmedString = function(mystring, pixellength, fontsize, fontname) {
    \\mystring is the stirng you want to trim
    \\pixellength is the size in pixel you want to fit
    \\fontsize is the size of text of the text statement you are going to use
    \\fontname same as fontsize
       if(mystring.length <= 0) return '';
       if(pixellength <= 0) return '';
       var ret = mystring;
       var textsize = 0;
       var textopt = text({x: -100, y: -100, text: ret, size: fontsize, font: fontname});
       textsize = textopt.w;
       for(; textsize >= pixellength;) {
           ret = ret.substr(0,ret.length - 1);
           if(ret.length<=0) return '';
           textopt = text({x: -100, y: -100, text: ret, size: fontsize, font: fontname});
           textsize = textopt.w;
        }
       return ret;
    };
    Effective usage is for server names in server signatures, some people give huge names to those servers and they might be too big for your graphics. Lets say that you have a big boxed graphic and the box for server name is 200px with this function you get enough chars to fill that 200px and nothing more :-)

    here is an example
    Code:
    var trimsname = getPixelTrimmedString (s.name, 200, 12, 'fonts/VeraBd.ttf');
    text({x: 10,y: 10, text: trimsname , size: 12, font:'fonts/VeraBd.ttf'});

  17. #137
    PHP Developer
    Join Date
    2011-11-21
    Location
    Amsterdam, The Netherlands
    Posts
    279
    BF3 PC
    Grezvany13
    Gamer IDs

    XFIRE ID: Grezvany13 Steam ID: Grezvany13

    Re: Sig coding: Collection of useful functions

    @John_Strambo: Interesting approach, by placing the text outside the image and check the width of the box.

    One small suggestion though; now you place the text at x: -100, y: -100 which shouldn't give any problems. However, to be on the safe side I suggest to place it at x: im_width+100, y: im_height+100 (so bottom right), just in case someone uses weird fonts and heights.

    So the modified version would be:
    Code:
    /**
     * @param string mystring The string you want to trim
     * @param int pixelsize The max width the string may be
     * @param int fontsize The font size you want to use
     * @param string fontname The name of the font you want to use
     */
    var getPixelTrimmedString = function(mystring, pixellength, fontsize, fontname) {
       if(mystring.length <= 0) return '';
       if(pixellength <= 0) return '';
       var ret = mystring;
       var textsize = 0;
       var textopt = text({x: (im_width+100), y: (im_height+100), text: ret, size: fontsize, font: fontname});
       textsize = textopt.w;
       for(; textsize >= pixellength;) {
           ret = ret.substr(0,ret.length - 1);
           if(ret.length<=0) return '';
           textopt = text({x: (im_width+100), y: (im_height+100), text: ret, size: fontsize, font: fontname});
           textsize = textopt.w;
       }
       return ret;
    };
    Member of [DD] DoubleDutchClan - Largest Dutch Multi Gaming Community Since 2007



    Proud developer of: BF3Stats API Class - A simple PHP Framework for your own projects

  18. #138

    Re: Sig coding: Collection of useful functions

    It shouldnt really matter as the x,y pair is always the bottom of the text so text extends from -100 to <-100 (i.e.towards -200), unless there are fonts who can extend around or below your X instead of above your X but I dont think it can be done.

  19. #139

    Re: Sig coding: Collection of useful functions

    I wonder if you guys can help me out.

    I just started on Sig making and it is easy when you know how, thank god for JS

    I am looking for a piece of code which can return the top three weapons in a specific class only. I have been asked to make a sig specifically for Recon only.

    (I found it)
    Last edited by Athrun1234; 2012-04-13 at 11:31.

  20. #140

    Re: Sig coding: Collection of useful functions

    You were quick

    I never checked any existing function but I made one for vehicles where I could extract just certain vehicles types and then use the sorting function on the resulting array.


    Code:
    var getVehiclesListByType=function(types) {
        var slist=[];
        if(typeof(types) != 'string') return slist;
        var vtypes = types.split(' ',20);    
        for(var ntypes in vtypes) {
            for(var nveh in p.stats.vehicles) {
                if(p.stats.vehicles[nveh].type == vtypes[ntypes]){
                    slist.push(p.stats.vehicles[nveh]);
                }
            }
        }
        return slist;
    };
    Its main purpose is to get one array of multiple vehicle types. To get all heli you would list 'vAH vSH vmT', this function can be easily modified to extract kits from weapons list (e.g. 'recon general' to get all weps for recon class including general weps).

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
P-STATS NETWORK FORUM LOGIN CREATE ACCOUNT