Page 1 of 4 1234 LastLast
Showing results 1 to 20 of 68
  1. #1

    Default TWStats map from rankings

    The idea behind this script is to go to any page on the rankings and make a twstats map of the first 10 tribes/players on that page. It works for the basic tribe/player rankings as well as for the continent or OD rankings.

    It took a bit of fussing to try to find the 10 best colors. I'm open to sugestions if you'd like the colors changed but in most cases you'll probably have to manually change the map if the colors don't work rather than changing the code.

    without whitespace:
    Code:
    javascript:var%20doc=document;if(window.frames.length>0)doc=window.main.document;url=doc.URL;link='http://twstats.com/'+getWorld(url)+'/index.php?page=map&centrex=500&centrey=500';link+='&zoom=100&grid=1&nocache=1&fill=000000';function%20getID(url){var%20start=url.indexOf("id=")+3;var%20end=url.indexOf('%26',start);var%20id;if(end>0)id=url.substring(start,end);else{id=url.substring(start);}return%20id;}function%20getWorld(url){start=url.indexOf("en");return%20url.substring(start,url.indexOf('.',start));}if(url.indexOf('screen=ranking')==-1){alert('This%20script%20needs%20to%20be%20called%20from%20one%20of%20the%20rankings%20pages');}else{table="";ths=doc.getElementsByTagName('th');for(i=0;i<ths.length&&table=="";i++){if(ths[i].innerHTML=='Rank'){table=ths[i].parentNode.parentNode;}}type='';if(url.indexOf('mode=player')!=-1||url.indexOf('mode=con_player')!=-1||url.indexOf('mode=kill_player')!=-1)type='player';else%20if(url.indexOf('mode=ally')!=-1||url.indexOf('mode=con_ally')!=-1||url.indexOf('mode=kill_ally')!=-1)type='tribe';rows=table.rows;for(i=1;i<11;i++){tLink=rows[i].cells[1].childNodes[0].href;link+='&'+type+'_'+(i-1)+'_id='+getID(tLink);}link+='&'+type+'_0_colour=00FF00';link+='&'+type+'_1_colour=00FFFF';link+='&'+type+'_2_colour=FFFFFF';link+='&'+type+'_3_colour=FFFF00';link+='&'+type+'_4_colour=FF8040';link+='&'+type+'_5_colour=FF0080';link+='&'+type+'_6_colour=C0C0C0';link+='&'+type+'_7_colour=FF0000';link+='&'+type+'_8_colour=808080';link+='&'+type+'_9_colour=FF00FF';window.open(link);}end();
    with whitespace:
    PHP Code:
    javascript:
    var 
    doc=document;
    if(
    window.frames.length>0)
        
    doc=window.main.document;
    url=doc.URL;
    link='http://twstats.com/'+getWorld(url)+'/index.php?page=map&centrex=500&centrey=500';
    link+='&zoom=100&grid=1&nocache=1&fill=000000';
    function 
    getID(url){
        var 
    start=url.indexOf("id=")+3;
        var 
    end=url.indexOf('%26',start);
        var 
    id;
        if(
    end>0)
            
    id=url.substring(start,end);
        else{
            
    id=url.substring(start);
        }
        return 
    id;
    }
    function 
    getWorld(url){
        
    start=url.indexOf("en");
        return 
    url.substring(start,url.indexOf('.',start));
    }
    if(
    url.indexOf('screen=ranking')==-1){
        
    alert('This script needs to be called from one of the rankings pages');
    }
    else{
        
    table="";
        
    ths=doc.getElementsByTagName('th');
        for(
    i=0;i<ths.length&&table=="";i++){
            if(
    ths[i].innerHTML=='Rank'){
                
    table=ths[i].parentNode.parentNode;
            }
        }
        
    type='';
        if(
    url.indexOf('mode=player')!=-1||url.indexOf('mode=con_player')!=-1||url.indexOf('mode=kill_player')!=-1)
            
    type='player';
        else if(
    url.indexOf('mode=ally')!=-1||url.indexOf('mode=con_ally')!=-1||url.indexOf('mode=kill_ally')!=-1)
            
    type='tribe';
        
        
    rows=table.rows;
        for(
    i=1;i<11;i++){
            
    tLink=rows[i].cells[1].childNodes[0].href;
            
    link+='&'+type+'_'+(i-1)+'_id='+getID(tLink);
        }
        
    link+='&'+type+'_0_colour=00FF00';
        
    link+='&'+type+'_1_colour=00FFFF';
        
    link+='&'+type+'_2_colour=FFFFFF';
        
    link+='&'+type+'_3_colour=FFFF00';
        
    link+='&'+type+'_4_colour=FF8040';
        
    link+='&'+type+'_5_colour=FF0080';
        
    link+='&'+type+'_6_colour=C0C0C0';
        
    link+='&'+type+'_7_colour=FF0000';
        
    link+='&'+type+'_8_colour=808080';
        
    link+='&'+type+'_9_colour=FF00FF';
        
        
    window.open(link);
    }
    end(); 
    This one will work from a tribe's members page:
    Code:
    javascript:var%20doc=document;if(window.frames.length>0)doc=window.main.document;var%20url=doc.URL;var%20link='http://twstats.com/'+getWorld(url)+'/index.php?page=map&centrex=500&centrey=500';link+='&zoom=100&grid=1&nocache=1&fill=000000';function%20getID(aUrl){var%20start=aUrl.indexOf("id=")+3;var%20end=aUrl.indexOf('%26',start);var%20id;if(end>0)id=aUrl.substring(start,end);else{id=aUrl.substring(start);}return%20id;}function%20getWorld(){start=url.indexOf("en");return%20url.substring(start,url.indexOf('.',start));}if(url.indexOf('screen=info_member')==-1){alert('This%20script%20needs%20to%20be%20called%20from%20a%20tribe\'s%20members%20page');}else{table="";ths=doc.getElementsByTagName('th');for(i=0;i<ths.length&&table=="";i++){if(ths[i].innerHTML=='Rank'){table=ths[i].parentNode.parentNode;}}rows=table.rows;for(i=1;i<Math.min(11,rows.length);i++){tLink=rows[i].cells[0].getElementsByTagName('a')[0].href;link+='&player_'+(i-1)+'_id='+getID(tLink);}link+='&player_0_colour=00FF00';link+='&player_1_colour=00FFFF';link+='&player_2_colour=FFFFFF';link+='&player_3_colour=FFFF00';link+='&player_4_colour=FF8040';link+='&player_5_colour=FF0080';link+='&player_6_colour=C0C0C0';link+='&player_7_colour=FF0000';link+='&player_8_colour=808080';link+='&player_9_colour=FF00FF';window.open(link);}end();
    Last edited by servy : 2008,August 31st at 03:00 Reason: added new script

  2. #2

    Default

    I have a feeling some of the mapmakers are going to like not having to put so much effort into getting the raw data for their maps. Either that or it'll give enough people easy access to the data so they won't need to use such maps as often.

  3. #3

    Co-community manager
    allyboo's Avatar
    Join Date
    2007,August 5th
    Location
    Hamburg, Germany
    Posts
    2,154

    Default

    This is a yummy tool. I think this will encourage more graphical maps perhaps, because the biggest pain in doing these things is getting the initial image to work from, and you've just fixed that. Many thanks
    zomgtw.net - farmfinder, player/tribe achievements & other stuff
    InnoGames

  4. #4
    cecala's Avatar
    Join Date
    2008,January 23rd
    Posts
    2,964

    Default

    thx servy u work fast... =)

    anyway is there a fast way to change the amount of top tribes u want to be included??

    like easily change it from top 10 to 15 or 20?
    Last edited by cecala : 2008,August 30th at 08:40 Reason: typo
    Pokerface1712 Once said,

  5. #5

    Join Date
    2008,February 27th
    Posts
    1,409

    Default

    Thanks alot servy

    This is just what i need to speed up my map making

  6. #6

    Default

    another cool script servy!

    hey, is there anyway to modify this script to run from a tribe's members page?

    . . . although i guess you would have to enter center and zoom info manually to make it more tribe specific. . . no, i still think its a cool idea. . . possible?

  7. #7

    Default

    Quote Originally Posted by cecala View Post
    thx servy i work fast... =)

    anyway is there a fast way to change the amount of top tribes u want to be included??

    like easily change it from top 10 to 15 or 20?
    It wouldn't be that hard to include the tribes, but the big issue is that there aren't that many more colors and most of the remaining colors don't contrast well with the others. If you didn't care that they were all the same color then the change would only take a minute or two.

  8. #8

    Default

    Quote Originally Posted by stabfight View Post
    another cool script servy!

    hey, is there anyway to modify this script to run from a tribe's members page?

    . . . although i guess you would have to enter center and zoom info manually to make it more tribe specific. . . no, i still think its a cool idea. . . possible?
    Should be possible. I'll look into it tomorrow.

  9. #9

    Default

    coool

  10. #10

    Default

    Another map maker thankful for this nice script.


    The part 'link+='&zoom=100&grid=1&nocache=1&fill=000000'; ' is the one where you can change the zoom, right?

    Another question...the color used for each tribe must be same as the colors used on TWMaps? I could easily take from photoshop codes for 20 different colors that don't look too same. As cecala, I'd like to see this for more than 10 tribes

  11. #11

    Default

    If you had any color that isn't one of the options for the twstats map it would default it to grey.

  12. #12

    Default

    So here's a pretty lame question, why doesn't TWMaps get some improvement where one could choose more colors? Something like http://en14.twmaps.org/. TWMaps have darker green, and better grid lines so I prefer to use those maps as base for later editing

  13. #13

    Default

    that site has no way of saving the maps that you make nor crating them via a get request, as far as I can tell, making that an impossible option.

  14. #14

    Default

    I wasn't sure based on your post if you wanted suggestions on the colors but I suggest changing light grey to dark blue since light grey is similar to white.

    Also light purple to dark purple since pink and light purple are hard tell apart.

    This is not a complaint servy; thanks so much this will save me so much time.

  15. #15

    Default

    I originally had dark blue in there but it was extremely hard to tell apart from the black background. Same with the dark purple.

  16. #16

    Default

    Quote Originally Posted by servy View Post
    I originally had dark blue in there but it was extremely hard to tell apart from the black background. Same with the dark purple.
    Oh right, I changed the background and forgot.

  17. #17

    Default

    Well done.

    I would suggest replacing light grey with light blue and light purple with dark purple or burgundy.

  18. #18

    Default

    *pssst*

    Quote Originally Posted by stabfight View Post

    . . . hey, is there anyway to modify this script to run from a tribe's members page?

  19. #19

    Default

    I just moved in to college today, I'll look into it later.

  20. #20

    Default

    Just added that to the OP.

    /me demands huggles.

Page 1 of 4 1234 LastLast

Posting Rules

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