Map/Coord Tribal Wars Map and Corridor Maps

secundum

Active Member
Reaction score
14
Author
secundum
Contributors
suilenroc
Quickbar Entry
javascript:var markSVillage=83,markDVillage=68,removeLine="r",drawLine="f",sdLine="c";setTimeout(()=>{"object"!=typeof hotkeylist[markSVillage]&&hotkeyfunction.save(markSVillage,"w",!1),"object"!=typeof hotkeylist[markDVillage]&&hotkeyfunction.save(markDVillage,"x",!1),display.panel("settings",0,1),display.panel("messages",0,1)},1e3);var keydownHandler=function(e){e.key==drawLine?(manual(mapvars.mapx,mapvars.mapy,"1"),show("Move the mouse pointer to the point where you want to draw a line and release the keyboard key.",3)):e.key==removeLine&&(draw.list.pop(),draw.build(),draw.refresh()),document.removeEventListener("keydown",keydownHandler)};function addUI(){jQuery("#coord > table > tbody > tr").append(`<td>
<table cellpadding="0" cellspacing="0" class="MenuO">
<tbody>
<tr class="MenuD hmm hmmtop">
<td class="center">
</span>Addon</a></td><td class="center">
<a href="javascript: draw.expoLines();">
</span> Export Lines</a></td></tr>
<tr class="center hmm hmmbottom"><td class="center"><a href="javascript: draw.expoUserscript();">
</span>Export script</a></td><td>
<a href="javascript:;" onclick="draw.impoLines(); return false;" >
Import Lines</a></td></tr>
</tbody></table>
</td>`)}document.addEventListener("keydown",keydownHandler),document.addEventListener("keypress",function(e){e.key==drawLine&&manual(mapvars.mapx,mapvars.mapy)}),document.addEventListener("keyup",function(e){e.key==drawLine?(draw.add(""+vars.start.x,""+vars.start.y,""+vars.dest.x,""+vars.dest.y,"3",display.drawcol),manual(mapvars.mapx,mapvars.mapy,"1"),manual(mapvars.mapx,mapvars.mapy)):e.key==sdLine&&draw.add(""+vars.start.x,""+vars.start.y,""+vars.dest.x,""+vars.dest.y,"3",display.drawcol),document.addEventListener("keydown",keydownHandler)}),draw.expoLines=function(){draw.copyToClipboard(JSON.stringify(draw.list)),window.alertmessage("Exportet lines")},draw.impoLines=function(){try{var e=prompt("Import String from another Map");JSON.parse(e).forEach(e=>{draw.add(e[0],e[1],e[2],e[3],e[4],e[5])}),window.alertmessage("Importet lines sucessfuly")}catch(t){window.alertmessage("Failed to import! Check your Insertet Text")}},draw.copyToClipboard=function(e){var t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch(a){window.alertmessage("Error while copying to clipboard")}document.body.removeChild(t)},draw.expoUserscript=function(){jQuery;var e="javascript:";e+='$.getScript("https://shinko-to-kuma.com/scripts/mapSdk.js").done(function() {',draw.list.forEach(t=>{e+=`MapSdk.lines.push({x1: ${t[0]},y1: ${t[1]},x2: ${t[2]},y2: ${t[3]},styling:{main: {"strokeStyle": "${t[5]}","lineWidth": 2},mini: {"strokeStyle": "brown","lineWidth": 2}},drawOnMini: true,drawOnMap: true,});`}),e+="MapSdk.mapOverlay.reload();});",draw.copyToClipboard(e),window.alertmessage("Exportet Script! Add it as new Script Ingame! /n Remove lines if the script eceeds 1000 characters, limit of scripts.")},addUI();
I guess a lot of people know http://tribalwarsmap.com.
Sadly the old discussion post https://forum.tribalwars.net/index.php?forums/tribal-wars-map.260/ is gone, but still linked in the page.
For those who don't know this tool yet. It is an interactive tribes worlds map that is updated every few hours and shows last conquered, activity, bash points etc..
Also you can color mark players, tribes and villages. Lines can only be drawn from coordinate to coordinate, so there are no lines that can be drawn exactly on the continent border or something.
I would apreciate if anyone knows who is maintaining it, and could forword me the information.


Corridor maps everybody knows the problem with bad pictures as corridor maps.
In the meantime there is the tribal map with which you can also draw your corridor maps.
Who has done this before knows that it can be an eternally long process.
In the following I will give you some tips and a script that makes it much faster to draw these maps.
So that you have your changes always saved, 'log in' so you can be sure that the map changes are not lost.

Draw and delete lines quickly with respective keys.
r removes the last painted line.
c draws a line from the start village (mark with s) to the destination village (mark with d).
f can be pressed and held to draw a line which is drawn when released.

Info: the used color for the line is the last selected one under Lines>Line Color.
Each key can be changed individually by you, I don't recommend to change the keys s and d because special codes are needed here.
import&export lines an be used to transfer all current lines to another map configuration.
export script creates a script to be used ingame on the map. (thks to Shinko to Kuma)



Add the script as a bookmark to ur Browser and run it on your tribalwarsmap.
There is also a usecript version availible but i dont provide it here, as i am not sure if its allowed even if its for a external website and doesn interact with the game. If Mods aprove it i can provide it.

Try to find following variables in the one line code an change them accordingly
JavaScript:
//Setup
// (keyCodes needed, can be different dependent on browser)
//Mark starting Village (Default = '83')
var markSVillage = '83';
//Mark Destination Village (Default = '68')
var markDVillage = '68';
/* If the preset buttons don't suit you feel free to change them according to your browser.
 The following website helps you just search (STRG+F) for  '83' and there you can see Browsers and keys and their number.
 https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
*/
// Remove last line
var removeLine = 'r';  // remove last line in list (last placed line)
var drawLine = 'f';  // draw line with drag ond drop buttonpress
var sdLine = 'c';  // draw line from start village to destination village


maybe you will become the new Picasso for corridor maps
2023-08-28 02_48_00-Window.png


The default used keys may only make sense with a german QWERTZ layout, feel free to suggest a better international default layout or combination.
 
Changelog
+ s and d to mark Start and Destination Villages
+ c to draw lines between Start and Destination Villages
+ r remove last drawn line
+ f draw lines with drag and drop
+ import&export of lines between Map configurations
+ MapSDK export to display lines ingame
Last edited:

secundum

Active Member
Reaction score
14
Updated
added export and import of lines between map configurations
fixed auto setting of hotkeys
added export to MapSDK script (can be used ingame on the map)
 
Top