Script input field problem

DeletedUser122676

Guest
I'm trying to make a script that helps dividing troops in scavenging.
Its mostly finished, but when i try filling in the input field of a troop, the number shows up in the input field, and immediatly dissapears.
Does anyone know what the problem is here?

(fyi, the script is made as a chrome extension)
 

JawJaw

Awesomest CM Ever
Reaction score
2,210
(fyi, the script is made as a chrome extension)

I am going to stop you right there and say that's illegal. All userscripts + extensions are considered illegal. You can only use quickbar scripts if they comply with the script rules.
 

DeletedUser122676

Guest
there is a train script on the chrome web store, and it was confirmed as legal...

Also i read the rules about scripts, as far as i know, im respecting all of them.

And if this is really illegal, could you give all the rules, or maybe a reference to those rules, i didnt find alot of information but a basic few rules
 
Last edited by a moderator:

JawJaw

Awesomest CM Ever
Reaction score
2,210
there is a train script on the chrome web store, and it was confirmed as legal...
lol, that train script is most definitely illegal ;)

Rules are simple:
- Userscripts = not allowed
- Extensions = not allowed
Furthermore from the rules page:
  • A script may not be used to send troops automatically or with fewer clicks than usual.
  • A script may not automatically send information or react to an event on your account (such as being attacked).
  • A script may not focus or click the Attack, Support or Ok button on the rally point / attack confirmation page.
  • A script may not interact with the Premium Exchange
Your extension falls under:
Bots, browser addons or other applications that automate game activities are forbidden
 

DeletedUser122676

Guest
you say my extension falls under "Bots, browser addons or other applications that automate game activities are forbidden", but it currently doesnt automate anything, it just calculates how i should divide my troops..., its like people having an excel sheet to calculate it, well, my extensions shows that info
So thats ok right

and about that train script, i saw people that asked if it was allowed, and someone from TW team answered it was legal since opera has the same ability on its own, in opera you can send whole train with 1 button press, so they said the chrome script was legal because opera users already have that advantage
 
Last edited by a moderator:

JawJaw

Awesomest CM Ever
Reaction score
2,210
Bud, it's illegal. Considering I'm also the one deciding what is legal and what is not on this market, I can tell you with 120% it is illegal. No discussion about it possible.

and about that train script, i saw people that asked if it was allowed, and someone from TW team answered it was legal since opera has the same ability on its own, in opera you can send whole train with 1 button press, so they said the chrome script was legal because opera users already have that advantage

Please provide me the ticket URL of that ticket (in private) so I can review it, because that is incorrect. The tool is not, and never was, considered legal.
 

OneMoreLight

Active Member
Reaction score
38
I'm also working on a scavenging script which I think does nothing illegal. The game is full of user made scripts that are approved and legal, surely we are allowed to make more if they comply withe the rules and then apply for approval?

mairoboy, you can fix your problem by triggering a change event for the input

Edit: Just noticed that you're making the script as a chrome extension. I'm making mine as a quickbar script, so I guess it's legal :)
 
Last edited:

tcamps

Non-stop Poster
Reaction score
109
If it was made into a quickbar or bookmarkable script it wouldn't be an issue, do it that way instead

Can you share the code that inserts troop counts?
 

JawJaw

Awesomest CM Ever
Reaction score
2,210
Edit: Just noticed that you're making the script as a chrome extension. I'm making mine as a quickbar script, so I guess it's legal :)
That would indeed be legal, as long as you keep the 1click = 1action rule in mind (and consider filling the form = 1 action).
 

OneMoreLight

Active Member
Reaction score
38
Thanks, will keep it in mind. One question... I put a focus on a button which I want to click by pressing Enter, I'm not overpassing the action, still need to press Enter, I'm just focusing 1 out of 4 buttons. Hope this is legal?
 

tcamps

Non-stop Poster
Reaction score
109
As I understand, generally yes, with the exception of:
  • "A script may not focus or click the Attack, Support or Ok button on the rally point / attack confirmation page."
 

OneMoreLight

Active Member
Reaction score
38
Not sure if you mean my script or the OP's but regardless will post mine. It's incomplete and very simple, have many ideas to improve it, lack the time and interest to keep working on it so may as well share it as it is

(It's not minified nor approved cause is still in progress but there should be no rules broken)


javascript:
// Sample template (can add/remove troops)
// Fills in only availabale troops so works both for def/off villages
var scavengeOptions = {
'Great Gatherers': [
{ type: 'spear', count: 10 },
{ type: 'sword', count: 10 },
{ type: 'axe', count: 10 },
{ type: 'light', count: 3 },
],
'Clever Collectors': [
{ type: 'spear', count: 10 },
{ type: 'sword', count: 10 },
{ type: 'axe', count: 10 },
{ type: 'light', count: 3 },
],
'Humble Haulers': [
{ type: 'spear', count: 10 },
{ type: 'sword', count: 10 },
{ type: 'axe', count: 10 },
{ type: 'light', count: 3 },
],
'Lackadaisical Looters': [
{ type: 'spear', count: 10 },
{ type: 'sword', count: 10 },
{ type: 'axe', count: 10 },
{ type: 'light', count: 3 },
],
};

var unitsCapacity = {
'spear': 25, 'sword': 15, 'archer': 10, 'axe': 10,
'heavy': 50, 'light': 80, 'marcher': 50, 'knight': 100
}

checkCorrectPage();
run();

function run() {
let btn = null;
for (const option in scavengeOptions) {
btn = findNextButton(option);

if (btn) {
fillInTroops(option, getAvailableUnits(), btn);
break;
}
}
}

function fillInTroops(option, availableUnits, button) {
scavengeOptions[option].forEach(units => {
const type = units.type;
const count = units.count;
let requiredCapacity = availableUnits[type] < count ? availableUnits[type] : count;

$(`input.unitsInput[name='${type}']`).val(requiredCapacity).trigger("change");
$(button).focus();
});
}

function findNextButton(option) {
let btn = $(`.scavenge-option:contains("${option}")`).find('a:contains("Start")');
if (btn.length > 0 && !$(btn).hasClass('btn-disabled')) return btn;
}

function getAvailableUnits() {
let availableUnits = {};

$('.units-entry-all').each((i, e) => {
const unitName = $(e).attr("data-unit");
const count = $(e).text().replace(/[()]/, '');
availableUnits[unitName] = parseInt(count);
});

return availableUnits;
}

function checkCorrectPage() {
const doc = document;
if (window.frames.length > 0 && window.main != null) doc = window.main.document;
const url = doc.URL;
if (url.indexOf('screen=place&mode=scavenge') == -1) alert('Use the script in the Rally point - Scavenging page!');
}
 
Last edited:
Top