На площади заполнить часть войск, а не все.

DeletedUser

Гость
Нашёл данные скрипты.

1. Заполнить только офф войска
Код:
javascript:Array.prototype.contains = function(obj) {var i, listed = false;for (i=0; i<this.length; i++) {if (this[i] === obj) {listed = true;break;}}return listed;};function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};units = Array('spy','axe','light','ram','marcher','catapult'); doc = getGameDoc();form = doc.units;inputs = form.getElementsByTagName('input');for (var i=0; i<inputs.length; i++) {if (inputs[i].type == 'text') {if (units.contains(inputs[i].name)) {next = inputs[i].nextSibling;do {next = next.nextSibling;} while (next.nodeType != 1);s = next.firstChild.nodeValue;insertUnit(form.elements[inputs[i].name], next.firstChild.nodeValue.replace(/\(/g, "").replace(/\)/g, ""));}}}


2. Заполнить только деф войска
Код:
javascript:Array.prototype.contains = function(obj) {var i, listed = false;for (i=0; i<this.length; i++) {if (this[i] === obj) {listed = true;break;}}return listed;};function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};units = Array('spear','archer','spy','sword','knight','heavy'); doc = getGameDoc();form = doc.units;inputs = form.getElementsByTagName('input');for (var i=0; i<inputs.length; i++) {if (inputs[i].type == 'text') {if (units.contains(inputs[i].name)) {next = inputs[i].nextSibling;do {next = next.nextSibling;} while (next.nodeType != 1);s = next.firstChild.nodeValue;insertUnit(form.elements[inputs[i].name], next.firstChild.nodeValue.replace(/\(/g, "").replace(/\)/g, ""));}}}

Вот спасибо! То что нужно! Этот язык мне мало знаком, но всё же придумал куда добавить. В конце кода есть текст "));}}}" , если между круглыми скобками добавить "/2", то заполниться половина войск.. Так же можно треть и четверть.
2. Заполнить только половину деф войск
Код:
javascript:Array.prototype.contains = function(obj) {var i, listed = false;for (i=0; i<this.length; i++) {if (this[i] === obj) {listed = true;break;}}return listed;};function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};units = Array('spear','archer','spy','sword','knight','heavy'); doc = getGameDoc();form = doc.units;inputs = form.getElementsByTagName('input');for (var i=0; i<inputs.length; i++) {if (inputs[i].type == 'text') {if (units.contains(inputs[i].name)) {next = inputs[i].nextSibling;do {next = next.nextSibling;} while (next.nodeType != 1);s = next.firstChild.nodeValue;insertUnit(form.elements[inputs[i].name], next.firstChild.nodeValue.replace(/\(/g, "").replace(/\)/g, "")/2);}}}
 

Полярис

Конный лучник
Оценка реакций
0
Я пользовался скриптом который в подкреп отправлял фиксированное число войск с одной деревни скажем: 1000коп+500лук+250ТК. А тут имеется ввиду, чтобы отправлял не конкретное число, а некий фиксированный % оставшихся войск? А чем это лучше?
 
Последнее редактирование:

DeletedUser38163

Гость
2. Заполнить только половину деф войск
Код:
javascript:Array.prototype.contains = function(obj) {var i, listed = false;for (i=0; i<this.length; i++) {if (this[i] === obj) {listed = true;break;}}return listed;};function getGameDoc() {getdoc = window.document;if(! getdoc.URL.match('game\.php')) {for(var i=0; i<window.frames.length; i++) {if(window.frames[i].document.URL.match('game\.php')) {getdoc = window.frames[i].document;}}}return getdoc;};units = Array('spear','archer','spy','sword','knight','heavy'); doc = getGameDoc();form = doc.units;inputs = form.getElementsByTagName('input');for (var i=0; i<inputs.length; i++) {if (inputs[i].type == 'text') {if (units.contains(inputs[i].name)) {next = inputs[i].nextSibling;do {next = next.nextSibling;} while (next.nodeType != 1);s = next.firstChild.nodeValue;insertUnit(form.elements[inputs[i].name], next.firstChild.nodeValue.replace(/\(/g, "").replace(/\)/g, "")/2);}}}
Вот это то что нужно) ставлю скрипт на отправку четверти деффа:thumbs:
 
Верх