DeletedUser33
Guest
Bueno este script lo vi en el net, es un script que sirve para poner un porcentaje de tropas, lo que me serviria por ejemplo para blindar mis pueblos fronterizos con poca tropa desde cada pueblito del nucleo
el script es este
[SPOIL]javascript: use_troop =[1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0]; percentile = prompt("Enter percentage"); troop_array = ["spear", "sword", "axe", "archer", "spy", "light", "marcher", "heavy", "ram", "catapult", "snob", "knight"]; total_troops = ["spear", "sword", "axe", "archer", "spy", "light", "marcher", "heavy", "ram", "catapult", "snob", "knight"]; doc = (window.frames.length > 0) ? window.main.document: document; function getTroop(a) {return parseInt(doc.units[a].parentNode.getElementsByTagName("a")[1].innerHTML.match(/\d+/), 10); } for (i = 0;i < troop_array.length;i++) {if (doc.getElementById("unit_input_" + troop_array) != null) {troop_array = doc.getElementById("unit_input_" + troop_array); } else {troop_array = 0; } if(use_troop == 1 && troop_array != 0) {total_troops = getTroop(total_troops); } else {total_troops = 0; } if (troop_array != 0) {troop_array.value = Math.floor(total_troops / 100 * percentile); } } void(0);[/SPOIL]
el script es este
[SPOIL]javascript: use_troop =[1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0]; percentile = prompt("Enter percentage"); troop_array = ["spear", "sword", "axe", "archer", "spy", "light", "marcher", "heavy", "ram", "catapult", "snob", "knight"]; total_troops = ["spear", "sword", "axe", "archer", "spy", "light", "marcher", "heavy", "ram", "catapult", "snob", "knight"]; doc = (window.frames.length > 0) ? window.main.document: document; function getTroop(a) {return parseInt(doc.units[a].parentNode.getElementsByTagName("a")[1].innerHTML.match(/\d+/), 10); } for (i = 0;i < troop_array.length;i++) {if (doc.getElementById("unit_input_" + troop_array) != null) {troop_array = doc.getElementById("unit_input_" + troop_array); } else {troop_array = 0; } if(use_troop == 1 && troop_array != 0) {total_troops = getTroop(total_troops); } else {total_troops = 0; } if (troop_array != 0) {troop_array.value = Math.floor(total_troops / 100 * percentile); } } void(0);[/SPOIL]
Última edición por un moderador: