insta-map

Discussion in 'Tribal Wars Map' started by fidodie, Feb 23, 2011.

Share This Page

  1. fidodie

    fidodie Well-Known Member

    Joined:
    Jan 9, 2009
    Messages:
    70
    Likes Received:
    0
    Thanks you for the continuing support and development of tribalwarsmap.com.

    Over in the script topic, the suggestion came up to map the origin of incoming.

    I was thinking that attacks tagged with their source (destination is already there) on the incoming
    page could be hi-lighted on the map.

    is there any way to URL encode village hi-lights (color for origin, and destination) and map center -
    zoom level could be automatic (or specified)

    a little javascript magic, and away we go!

    optionally, directional lines could be added, with color, and rollover information. tooltip on line could have attack name(type?), landing time,
    with instant back-timing info

    Many Thanks

    a natural extension to this might be a visual attack planner? but that is another topic....

    probably could think of 100s of ways to use this, but starting with the URL (or post type) passing of hi-light info
    is the key.
     
    Last edited: Feb 25, 2011
  2. tomcenc

    tomcenc Still Going Strong

    Joined:
    Nov 11, 2007
    Messages:
    845
    Likes Received:
    3
    My apologies for the slow response. I could definitely add some sort of tool to the map that automatically draws lines, back-timing info etc for all "attacks" passed to it by a post request.

    If someone could write a script that gathers this information, creates a form and submits it, I can add a tool that displays it on the map.
    Something like this (quick and dirty Javascript example):

    PHP:
    //Parse data first and add to parsedData array
    //Get number of entries
    var parsedDatalength=parsedData.length;
    //Variable for post data
    var fulldata='';
    //Array for processed data
    var data=[];
    //Create shortcut to encode function
    var e=encodeURIComponent;
    //Loop through data
    for(var i=0;i<parsedDataLength;i++) {
    //Add data to array and use "/" to join multiple variables
    data.push([e(parsedData[i][0]),e(parsedData[i][1])].join('/'));
    }
    //Join multiple attacks with &
    fulldata=data.join('&');
    //Add a form to the HTML (opens in blank tab)
    document.body.innerHTML+='<form id="tribalwarsmapattackform" action="http://en1.tribalwarsmap.com/" method="post" target = "_blank"><input name="attackdata" value="'+fulldata+'" /></form>';
    //Get form by ID
    var twmaf=document.getElementById("tribalwarsmapattackform");
    //Submit form
    twmaf.submit();
    //Remove form
    twmaf.parentNode.removeChild(twmaf);
    Best would be if the data could contain source village ID/coord, destination village ID/coord, time and attack name. "fulldata" would look like this for one attack:
    500%7C500/500%7C501/12:00/Attack example
    %7C=|

    I could easily write it myself too though, but I'm not playing any Tribal Wars account right now, so it is hard to write scripts like this.
     
  3. Donato-

    Donato- Non-stop Poster

    Joined:
    Dec 8, 2009
    Messages:
    150
    Likes Received:
    1
    This is a great idea, i thought it may have already been possible to connect highlights in game to highlights on twmaps, but have not been able to find it yet..
     
  4. dalesmckay

    dalesmckay Still Going Strong

    Joined:
    Mar 26, 2008
    Messages:
    712
    Likes Received:
    1
    PM me or hit me up on skype if you need any scripts done.