Twisted Legacy

Active Member
Reaction score
12
Author
Erlend
Contributors
Linoko
Quickbar Entry
javascript:
/*USER SETTINGS - CHANGE THESE TO YOUR PREFERENCE*/
var jumpToRandomVillage = false,
fakesPerVillage = 1,
forceEqualTroopCount = false,
distributeByPopulation = false,
troops = {
"spear": 0,
"sword": 0,
"axe": 0,
"archer": 0,
"spy": 'min',
"light": 0,
"marcher": 0,
"heavy": 0,
"ram": 0,
"catapult": 'min!'
},
/*Allowed troop inputs: numbers, 'min', 'max' and 'min!'.
'min!' will force at least one of this unit*/
minExclamationCount = 1,
dockMode = false;

/*ADMIN SETTINGS - CHANGED BY TRIBE ARISTOCRACY OR SCRIPT DISTRIBUTOR*/
var useForumCoords = true,
forumLink = "forum_id=3076&thread_id=7006",
forumSpoilerName = "coordsA",
hoursBeforeCheckingForum = 0.5,
coords = "",
populationLim = 0.01;

/*-------------------------- The Script, created by Erlend/Linoko 05.08.2020 --------------------------*/
function m(){if(!location.href.includes("overview_villages")||dockMode){if(jumpToRandomVillage){var e=localStorage.getItem("fs_fakecount");if(null==e&&localStorage.setItem("fs_fakecount",0),""==document.forms[0].x.value&&null==$(".village-item")[0]){if(e>=fakesPerVillage)return localStorage.setItem("fs_fakecount",0),void gtrv();localStorage.setItem("fs_fakecount",Number(e)+1)}}it(),jumpToRandomVillage&&!ci()&&(localStorage.setItem("fs_fakecount",0),gtrv())}else sc()}function it(){var e=guti(geu()),o=grc();document.forms[0].x.value=o.split("|")[0],document.forms[0].y.value=o.split("|")[1];for(var t=0;t<e.length;t++)$("input[id*="+e[t][0]+"]")[0].value=e[t][1]}function gtrv(){var e=$("a[href*=selectVillage]","#group_popup"),o=Math.floor(Math.random()*e.length);if(dockMode){if(e=$("a[href*=selectVillage]","#group_popup"),o=Math.floor(Math.random()*e.length),0==e.length)throw villageDock.open(),new Error("Village dock not open!");e[o].click()}else{if(villageIds=localStorage.getItem("fs_villagedata"),null==villageIds)return void alert("No villages found, please run the script from the overview page to update own villages");villageIds=villageIds.split(","),o=Math.floor(Math.random()*villageIds.length),window.location.href=window.location.href.replace(/(village=)\d+/,"village="+villageIds[o])}}function geu(){var e=[];for(key in troops)0!=troops[key]&&e.push([key,troops[key]]);return e}function guti(e){for(var o=[],t={spear:1,sword:1,axe:1,archer:1,spy:2,light:4,marcher:5,heavy:6,ram:5,catapult:8,knight:10,snob:100},r=[],l=[],a=0,i=0;i<e.length;i++){var n=0;isNaN(Number(e[i][1]))?e[i][1].includes("min")?(r.push(e[i][0]),n=0,l.push(i),e[i][1].includes("min!")&&(n=minExclamationCount)):"max"==e[i][1]&&(n=Number($("#units_entry_all_"+e[i][0])[0].innerText.match(/\d+/)[0])):n=e[i][1],o.push([e[i][0],n]),a+=n*t[e[i][0]]}for(var u=game_data.village.points*populationLim,s=(i=0,[0,3e4*populationLim]);a<u&&0!=r.length;){var c=Number($("#units_entry_all_"+o[l[i]][0])[0].innerText.match(/\d+/g)[0]);if((o[l[i]][1]<c||forceEqualTroopCount)&&o[l[i]][1]<s[0]&&(!distributeByPopulation||o[l[i]][1]<s[0]/t[o[l[i]][0]])&&(o[l[i]][1]+=1,a+=t[o[l[i]][0]]),i<r.length-1?i++:(i=0,s[0]+=1),s[0]>s[1]){o[l[i]][1]+=Math.ceil((u-a)/t[o[l[i]][0]]),a+=t[o[l[i]][0]];break}}return o}function grc(){if(useForumCoords){var e=Timing.getCurrentServerTime(),o=forumLink.split("forum_id=")[1].split("&")[0],t=forumLink.split("thread_id=")[1].split("&")[0],r="fs_coords_"+t+"_"+forumSpoilerName,l="fs_lastforumcheck_"+t+"_"+forumSpoilerName,a=localStorage.getItem(l);if(null!=a&&e-Number(a)<36e5*hoursBeforeCheckingForum)coords=localStorage.getItem(r);else try{$.get("/game.php?screen=forum&screenmode=view_thread&forum_id="+o+"&thread_id="+t).then(function(o){try{if(coords=$(o).find(".spoiler").has("[value='"+forumSpoilerName+"']").find("pre").html(),null==coords)throw Exception;localStorage.setItem(r,coords),localStorage.setItem(l,e.toString())}catch{throw alert("Coordinates could not be retrieved from forum post, make sure to format your coords like this: \n\n["+"spoiler="+forumSpoilerName+"]["+"code]123|456 456|789 876|543["+"/code]["+"/spoiler]"),new Error("Could not get coords!")}},"html"),localStorage.setItem("fs_fakecount",0)}catch{throw alert("Coordinates could not be retrieved from forum post, make sure to include forum1412&thread_id=18009 in your link!"),new Error("Could not get coords!")}}var i=coords.split(" ");return i[Math.floor(Math.random()*i.length)]}function ci(){for(var e=$(".unitsInput","#command-data-form"),o=$(".units-entry-all","#command-data-form"),t=!0,r=0;r<e.length;r++){var l=Number(o[r].innerText.match(/\d+/g)[0]);Number(e[r].value)>l&&(t=!1)}return t}function sc(){for(var e=$("a[href*=village]","#combined_table").has("span"),o="",t=0;t<e.length;t++){var r=e[t].href.split("village=")[1].split("&")[0];o+=t==e.length-1?r:r+","}localStorage.setItem("fs_villagedata",o),alert(e.length+" villages stored!")}m();
Public?
Public
The best faking script around
Below you will see a fake script.
This script is a multipurpose script.
With this one script you can customise to suit your needs.

Code:
javascript:
/*USER SETTINGS - CHANGE THESE TO YOUR PREFERENCE*/
var jumpToRandomVillage = false,
    fakesPerVillage = 1,
    forceEqualTroopCount = false,
    distributeByPopulation = false,
    troops = {
        "spear": 0,
        "sword": 0,
        "axe": 0,
        "archer": 0,
        "spy": 'min',
        "light": 0,
        "marcher": 0,
        "heavy": 0,
        "ram": 0,
        "catapult": 'min!'
    },
/*Allowed troop inputs: numbers, 'min', 'max' and 'min!'.
'min!' will force at least one of this unit*/
    minExclamationCount = 1,
    dockMode = false;

/*ADMIN SETTINGS - CHANGED BY TRIBE ARISTOCRACY OR SCRIPT DISTRIBUTOR*/
var useForumCoords = true,
    forumLink = "forum_id=3076&thread_id=7006",
    forumSpoilerName = "coordsA",
    hoursBeforeCheckingForum = 0.5,
    coords = "",
    populationLim = 0.01;

/*-------------------------- The Script, created by Erlend/Linoko 05.08.2020 --------------------------*/
function m(){if(!location.href.includes("overview_villages")||dockMode){if(jumpToRandomVillage){var e=localStorage.getItem("fs_fakecount");if(null==e&&localStorage.setItem("fs_fakecount",0),""==document.forms[0].x.value&&null==$(".village-item")[0]){if(e>=fakesPerVillage)return localStorage.setItem("fs_fakecount",0),void gtrv();localStorage.setItem("fs_fakecount",Number(e)+1)}}it(),jumpToRandomVillage&&!ci()&&(localStorage.setItem("fs_fakecount",0),gtrv())}else sc()}function it(){var e=guti(geu()),o=grc();document.forms[0].x.value=o.split("|")[0],document.forms[0].y.value=o.split("|")[1];for(var t=0;t<e.length;t++)$("input[id*="+e[t][0]+"]")[0].value=e[t][1]}function gtrv(){var e=$("a[href*=selectVillage]","#group_popup"),o=Math.floor(Math.random()*e.length);if(dockMode){if(e=$("a[href*=selectVillage]","#group_popup"),o=Math.floor(Math.random()*e.length),0==e.length)throw villageDock.open(),new Error("Village dock not open!");e[o].click()}else{if(villageIds=localStorage.getItem("fs_villagedata"),null==villageIds)return void alert("No villages found, please run the script from the overview page to update own villages");villageIds=villageIds.split(","),o=Math.floor(Math.random()*villageIds.length),window.location.href=window.location.href.replace(/(village=)\d+/,"village="+villageIds[o])}}function geu(){var e=[];for(key in troops)0!=troops[key]&&e.push([key,troops[key]]);return e}function guti(e){for(var o=[],t={spear:1,sword:1,axe:1,archer:1,spy:2,light:4,marcher:5,heavy:6,ram:5,catapult:8,knight:10,snob:100},r=[],l=[],a=0,i=0;i<e.length;i++){var n=0;isNaN(Number(e[1]))?e[1].includes("min")?(r.push(e[0]),n=0,l.push(i),e[1].includes("min!")&&(n=minExclamationCount)):"max"==e[1]&&(n=Number($("#units_entry_all_"+e[0])[0].innerText.match(/\d+/)[0])):n=e[1],o.push([e[0],n]),a+=n*t[e[0]]}for(var u=game_data.village.points*populationLim,s=(i=0,[0,3e4*populationLim]);a<u&&0!=r.length;){var c=Number($("#units_entry_all_"+o[l][0])[0].innerText.match(/\d+/g)[0]);if((o[l][1]<c||forceEqualTroopCount)&&o[l][1]<s[0]&&(!distributeByPopulation||o[l][1]<s[0]/t[o[l][0]])&&(o[l][1]+=1,a+=t[o[l][0]]),i<r.length-1?i++:(i=0,s[0]+=1),s[0]>s[1]){o[l][1]+=Math.ceil((u-a)/t[o[l][0]]),a+=t[o[l][0]];break}}return o}function grc(){if(useForumCoords){var e=Timing.getCurrentServerTime(),o=forumLink.split("forum_id=")[1].split("&")[0],t=forumLink.split("thread_id=")[1].split("&")[0],r="fs_coords_"+t+"_"+forumSpoilerName,l="fs_lastforumcheck_"+t+"_"+forumSpoilerName,a=localStorage.getItem(l);if(null!=a&&e-Number(a)<36e5*hoursBeforeCheckingForum)coords=localStorage.getItem(r);else try{$.get("/game.php?screen=forum&screenmode=view_thread&forum_id="+o+"&thread_id="+t).then(function(o){try{if(coords=$(o).find(".spoiler").has("[value='"+forumSpoilerName+"']").find("pre").html(),null==coords)throw Exception;localStorage.setItem(r,coords),localStorage.setItem(l,e.toString())}catch{throw alert("Coordinates could not be retrieved from forum post, make sure to format your coords like this: \n\n["+"spoiler="+forumSpoilerName+"]["+"code]123|456 456|789 876|543["+"/code]["+"/spoiler]"),new Error("Could not get coords!")}},"html"),localStorage.setItem("fs_fakecount",0)}catch{throw alert("Coordinates could not be retrieved from forum post, make sure to include forum1412&thread_id=18009 in your link!"),new Error("Could not get coords!")}}var i=coords.split(" ");return i[Math.floor(Math.random()*i.length)]}function ci(){for(var e=$(".unitsInput","#command-data-form"),o=$(".units-entry-all","#command-data-form"),t=!0,r=0;r<e.length;r++){var l=Number(o[r].innerText.match(/\d+/g)[0]);Number(e[r].value)>l&&(t=!1)}return t}function sc(){for(var e=$("a[href*=village]","#combined_table").has("span"),o="",t=0;t<e.length;t++){var r=e[t].href.split("village=")[1].split("&")[0];o+=t==e.length-1?r:r+","}localStorage.setItem("fs_villagedata",o),alert(e.length+" villages stored!")}m();

Break Down of the attack script
In the script snippets below, you will notice that I have colour coded the first half of the Script. The second half should never be changed

The sections in red are the titles/admin text to explain what the section above or below does.

The Blue sections are then the areas of the script which you can change to suit your needs.

Let's Begin
/*USER SETTINGS - CHANGE THESE TO YOUR PREFERENCE*/

False = Turned off, true = Turned on

You will notice there are parts there that say false so if you read what they are and decide you want to turn them off or on change the word next to them I.e change false to true or vis versa.



var jumpToRandomVillage = false,
fakesPerVillage = 1,
forceEqualTroopCount = false,
distributeByPopulation = false,


The next section is the troops and below that blue section is a red section that explains what you can put next to troops.

troops = {
"spear": 0,
"sword": 0,
"axe": 0,
"archer": 0,
"spy": 'min',
"light": 0,
"marcher": 0,
"heavy": 0,
"ram": 0,
"catapult": 'min!'
}, /


/*Allowed troop inputs: numbers, 'min', 'max' and 'min!'.
'min!' will force at least one of this unit*/

You should notice your are allowed 4 options, Your own number of troops, min, max and min!.

So min means it'll try and force atleast 1 into the attack rally but if you dont have that type of troop it wont bother.

Max means all of that type of unit will be inserted in the rally point.. I.e you have 6000 axe and it'll input the 6000 axe

min! This will always put a 1 into the rally point for what ever unit you choose, even if you dont have 1 it'll still input it.

Admin/Tribe setting
/*ADMIN SETTINGS - CHANGED BY TRIBE ARISTOCRACY OR SCRIPT DISTRIBUTOR*/

var useForumCoords = true,
forumLink = "forum_id=3076&thread_id=7006",
forumSpoilerName = "coordsA",
hoursBeforeCheckingForum = 0.5,

Above you will see 4 lines of code. In these 4 lines the Script is asking a question do I look for the coords in the fourm. If yes what's the forum link. The forum link is the ending of the url to where you will be hosting the coords.
Next we have the spoiler name coordsA.
This means it will search the forum URL and look for a spoiler called coordsA to which the coords to attack will be inside

coords = "",
populationLim = 0.01;

Lastly if you dont want to attack the tribes coords and want to attack your own you simply change the true to false and then in the section coords = "", you enter your own attack coords

one last thing to add, if you dont use the code bb tags when posting this in the forum or mail itll break the script due to it using coord examples in the bottom section of the script.

it will attempt to read the coords as an actual village which doesn't exsist
 
Last edited:
Upvote 2

DaWolf85

Non-stop Poster
Reaction score
583
Could you or someone else edit the fake script contained in the body of this post to be in code tags? The forum is auto-converting parts of it to emojis. It copies and pastes fine, actually, but I suspect not everyone will realize that.
 

*kronus*

Active Member
Reaction score
1
Great script but I would appreciate if the troops to be sent from the assembly point calculated them based on points, instead of 'min' - max - 'min! , those that the system puts are not always enough.
 
Last edited:

world8vet

Still Going Strong
Reaction score
316
Did you get permission from Linoko to post this?

The script was already approved via a support ticket.
 

Twisted Legacy

Active Member
Reaction score
12
Did you bother reading it mate? It clearly states that " private scripts" are in the private section where the thread can only be viewed by the author of the script. You posted it to the public without the approval of the author.

You're just wrong

I did not have any form of contact with Erland or Linko
tw121.PNG
 

Twisted Legacy

Active Member
Reaction score
12
It was approved, you were already able to use it. You did not have the right to post it to the public, accept that.

Seriously.. Go read the link to the fourm script rules I posted above.. I followed them all. Hence why this forum has been approved.

Ticket numbers no longer mean anything due to the new rules that took affect since Feb 2021
 

world8vet

Still Going Strong
Reaction score
316
Seriously.. Go read the link to the fourm script rules I posted above.. I followed them all. Hence why this forum has been approved.

Ticket numbers no longer mean anything due to the new rules that took affect since Feb 2021

Like i already said, you didn't follow it. It was a private script, you made it public. A script owner already came and callet you out for posting the script without his approval.
 

Twisted Legacy

Active Member
Reaction score
12
Like i already said, you didn't follow it. It was a private script, you made it public. A script owner already came and callet you out for posting the script without his approval.

This will be my last repsonse on this as scripts forum posts are for people to use the script.. Not for arguing,
This may have been a private script originally, However I do not know Erland or Linko at all but I was given the script leading me to believe this was public enough to be considered a public script with no forum post.

On Feb 2021 script rules changed, Scripts from that date must be submitted via the forum whether or not they had already been approved via support tickets.
If a script is not submitted via the forum it is considered unapproved and will ultimatly lead to a Ban.
I submitted this script via the forum and like most at the time it took between 2 weeks and 1 month to be approved and its taken you almsot 2 months to complain.

Now for the same reasons I stated in G2K Script, If a script is approved and public then you know its legal.
If a script is approved and private you will probably get a reponse stating thats its approved but private.
If a script has not been submitted and your using it you most likely get banned.

Due to me using the script I submitted it for public approval as 1. I believed it was a public well known script as stated above and 2. If someone else had already submitted it as private I would not be able to see that unless I submitted another copy via the forum.

As the rules state in submitting a script that is not your own, try to make contact and if unable or script author does not want to do a forum post then the non author who in this case is me submits the script anyways for the approval so it's legal for me to use.

Erland and LInko I do not know and I am in the unoffical discord scripts server which they are not as far as I am aware. So if they had quit Tribalwars and no longer played or had anything to do with this game then I needed to make a submission to have the script approved.

Lastly. As i mentioned above this will be my last response on this matter, You've not claimed to be the author, so to my knowledge you are some fourm person who has decided to target me for unnessacery harrasment in multiple threads of mine. I never claimed credit for any of the scripts I have uploaded except one and tried to make contact where possible.

I want to remind you that the script submission rules have changed and here is the link. I would higly recommend you read the section subtitled " Script is not yours? "
 

wellcome

Member
Reaction score
0
hi, i tried to use this script and is very usefull. But i've one question:
fakesPerVillage = 1

when i used, the script did not count the fakes and sent several in the same village, did I do something wrong?
 
Top