Verified:

TheMafia

Member
57

May 20th 2015, 4:36:15

INSTALLATION STEPS AT BOTTOM OF THIS POST UNDER 'SETUP'

What it does ================================================

Score Board: http://tcpm.mrlazyinc.com/..._monkey_script_scores.PNG
Portal Leader Boards: http://tcpm.mrlazyinc.com/...monkey_script_leaders.PNG
Market (v2): http://tcpm.mrlazyinc.com/..._monkey_script_market.PNG
Research (v3): http://tcpm.mrlazyinc.com/...onkey_script_research.PNG
Browser Tab Title (v3): http://tcpm.mrlazyinc.com/..._script_browser_title.PNG
Buildings (v4): http://tcpm.mrlazyinc.com/...nkey_script_buildings.PNG
Building Percentage (v6.8): http://tcpm.mrlazyinc.com/...key_script_build_perc.PNG
Spy (v6): http://tcpm.mrlazyinc.com/...y_script_spy_military.PNG
NEW: -- Turns Left (v6.5): http://tcpm.mrlazyinc.com/...key_script_turns_left.PNG
NEW: -- Attacker defending news summary (7.5): LINK INC.

This script will automate a lot of tedious tasks and do a lot of calculations for you on the fly.

Latest Changes ================================================
Version 8.0 (Dec 2022):
-Fixed an issue with news summary that crashed the script when calculating land for a victorious defense

Version 7.9 (Nov 2022):
-First attempt at fixing news not showing after you get special messages from the game, news would be hidden due to the code calling for news summary too soon and marking it as 'read' in the background, may not have fixed all situations yet, will add more as I see them come up

Version 7.8 (Oct 2022):
-Proud to say you no longer have to click on the 'defending' link to show the news summary, with some fun code this is now available on your main page immediately
-Colour coding has begun in the news summary, next up: total units exchanged for each player

Version 7.6 (Oct 2022):
-Added the number of attacks a player has done to news summary of land lost.

Version 7.5 (Oct 2022):
-New featured start: News summary. This will show you all the players who have attacked you and the amount of land they took total for this round.
Note: This will ONLY show when you are looking at news for your country, for best results click on "Defending" in the news links so that the script can see all attacks and not just for one day.

Version 7.1 (Sept 2022):
-Fixed turns lefts: no more decimals

Version 7.0 (Sept 2022):
-remake of the 'turns left' calculation on 'main menu' (now shows remaining turns correctly for the round)

Version 6.97 (Sept 2022):
-Fixed market tax calculation issue for Democracy (no market tax)

Version 6.95:
-Explore automatically adds '1' to field instead of default of '0'

Version 6.9:
-minor fix for building percentages (total count was off)

Version 6.8:
-New feature: in building page you will now see the percentage each building type occupies on your land.
--Total land is now displayed above the percentages column (see pic)

Version 6.5:
-"Turns Left" added to main page (picture above)
--based on the server you are playing on, the script will try to estimate how many turns you can expect in the future from this moment on.

!Version 6.1:
-fixed calculations to show:
--Defence Points
--Minimum Jets to send


Setup / Installation ================================================

Required:
Browser (like chrome) with a javascript auto execute add on (like 'TamperMonkey', google it) or equvilent
add on needs to support including jQuery library

What you need to do:
Lets say you use tamperMonkey and chrome.
-Open the dashboard for tampermonkey
-start a new script
-copy the script from below into the new page.



// ==UserScript==
// @name EarthEmpires - Assit Tools and Calculations
// @namespace http://www.mrlazyinc.com/
// @version 8.0
// @author TheMafia
// @match *://*.earthempires.com/*
// @match *://earthempires.com/*
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==


var currentPage = window.location.href;
var turns = jQuery(".topbar td:contains('Turns:')").last().text().replace("Turns: ", "");
var money = jQuery(".topbar td:contains('Money:')").last().text().replace("Money: ", "");
document.title = "T:("+ turns + ")" + "M:"+ money;

if ((currentPage.indexOf("scores") > 0 || (currentPage.indexOf("market") > 0 && currentPage.indexOf("sell") < 1)) && currentPage.indexOf("forum") <= 0) {
var intv = setTimeout(function(){
var curPage = window.location.href;
window.location = curPage;
}, 60000);
}

if (currentPage.indexOf("explore") > 0){
//Add 1 to field
jQuery("input[name='turns']").val(1);

}


if (currentPage.indexOf("spy") > 0){
//Check if spied
if (jQuery("th:contains('Military Forces')").length > 0){
var parentBody = jQuery("th:contains('Military Forces')").parent().parent();
jQuery(parentBody).append("<tr><td>Defence Points</td><td class='rt' id='forceCalc'></td></tr>");
jQuery(parentBody).append("<tr><td>Min Jets Hit:</td><td class='rt' id='jetCalc'></td></tr>");

var troops = parseInt(jQuery(parentBody).find("tr").eq(2).find("td").eq(1).text().replace(",","").replace(",","")) ;
var turrets = parseInt(jQuery(parentBody).find("tr").eq(4).find("td").eq(1).text().replace(",","").replace(",",""));
var tanks = parseInt(jQuery(parentBody).find("tr").eq(5).find("td").eq(1).text().replace(",","").replace(",",""));
console.log("1: "+ troops + " -2:"+ turrets +" -3:"+ tanks);

var attackMin = (troops) + turrets*2 + (tanks *4);
var jetMin = attackMin / 2;
jQuery("#forceCalc").text(attackMin);
jQuery("#jetCalc").text(jetMin);
}
}


if (currentPage.indexOf("main") > 0){
//Check if spied
var serverType = jQuery("td:contains('Server')").next("td").text();
var timeLeft = jQuery("#maintable").next().next().text();
var turnsLeft = 0;
var timeInterval = 1;
switch(serverType){
case "Express":
timeInterval = 4;
break;
case "Tournament":
timeInterval = 25;
break;
case "Primary":
timeInterval = 30;
break;
case "Team":
timeInterval = 15;
break;
case "Alliance":
timeInterval = 20;
break;
case "Free For All":
timeInterval = 20;
break;
}

if (timeLeft.indexOf("hours") > 0){
timeLeft = timeLeft.replace("The round ends in ", "");
timeLeft = timeLeft.replace("hours.", "");
turnsLeft = (60 * parseFloat(timeLeft)) / timeInterval;
}else if (timeLeft.indexOf("days") > 0){
timeLeft = timeLeft.replace("The round ends in ", "");
timeLeft = timeLeft.replace("days.", "");
turnsLeft = (60 * 24 *parseFloat(timeLeft)) / timeInterval;
}
jQuery("#maintable").next().next().append("<br>Turns left: "+ Math.round(turnsLeft));

jQuery("body").append("<div id='newsSummary' style='position:fixed; top:20px; right: 20px; color:white'></div><div id='newsPull' display='none'></div>");


var tempHTML = jQuery.parseHTML("");

if(jQuery(".recentnewsitem").length == 0 && jQuery("a:contains('Continue to Main Page')").length < 1){
var defUrl = jQuery("#content a:contains('Defending')").attr("href");
console.log(defUrl);

var ajDefending = jQuery.ajax({
url:defUrl, async:true, cache:false, method: "GET"})
.always(function(){

}).done(function(data){
tempHTML = jQuery.parseHTML(data);
//console.log(jQuery(tempHTML).find(".recentnewsitem").html());
//jQuery("#newsPull").html(jQuery(tempHTML).find(".recentnewsitem").html());
var attackers = [];
var playerCount = 0;
jQuery(tempHTML).find(".recentnewscontent:contains('A brigade from')").each(function(){
console.log("tesT");
var sStart = jQuery(this).text().indexOf("A brigade from") + 15;
var sEnd = jQuery(this).text().indexOf(" has invaded your lands");
var attackerName = jQuery(this).text().slice(sStart, sEnd);
var regNum = /\(#(.+?)\)/g;
var attackerNum = jQuery(this).text().match(regNum)[0].replace("(#", "").replace(")", "");

var curIndex = -1;
for(var i = 0; i < attackers.length; i++){
if(attackers[i].attackerNum == attackerNum){
curIndex = i;
break;
}
}

var landLost = 0;
var lostContainer = jQuery(this).find("div:contains('Acres')");
regNum = /.+? Acres/g;
if (lostContainer.length > 0){
landLost = parseInt(lostContainer.text().match(regNum)[0].replace(" Acres", ""));
}

if(curIndex > -1){
attackers[curIndex].land = attackers[curIndex].land + landLost;
attackers[curIndex].attCnt = attackers[curIndex].attCnt + 1;
}else{
attackers[attackers.length] = {attackerName: attackerName, attackerNum: attackerNum, land: landLost, attCnt: 1};
}


});

for(var i = 0; i < attackers.length; i++){
var colour = "white";
if (attackers[i].attCnt > 1){
colour = "yellow";
}
jQuery("#newsSummary").append("<div class='attackerInfo' style='text-align:right; color:"+ colour +"'>"+ attackers[i].attackerName + " "+ attackers[i].attCnt +" times, took: "+ attackers[i].land +"</div>");
}

}).fail(function(){

});
}else{
var attackers = [];
var playerCount = 0;
jQuery(document).find(".recentnewscontent:contains('A brigade from')").each(function(){
console.log("tesT");
var sStart = jQuery(this).text().indexOf("A brigade from") + 15;
var sEnd = jQuery(this).text().indexOf(" has invaded your lands");
var attackerName = jQuery(this).text().slice(sStart, sEnd);
var regNum = /\(#(.+?)\)/g;
var attackerNum = jQuery(this).text().match(regNum)[0].replace("(#", "").replace(")", "");

var curIndex = -1;
for(var i = 0; i < attackers.length; i++){
if(attackers[i].attackerNum == attackerNum){
curIndex = i;
break;
}
}
var landLost = 0;
var lostContainer = jQuery(this).find("div:contains('Acres')");
regNum = /.+? Acres/g;
if (lostContainer.length > 0){
landLost = parseInt(lostContainer.text().match(regNum)[0].replace(" Acres", ""));
}

if(curIndex > -1){
attackers[curIndex].land = attackers[curIndex].land + landLost;
attackers[curIndex].attCnt = attackers[curIndex].attCnt + 1;
}else{
attackers[attackers.length] = {attackerName: attackerName, attackerNum: attackerNum, land: landLost, attCnt: 1};
}


});

for(var i = 0; i < attackers.length; i++){
var colour = "white";
if (attackers[i].attCnt > 1){
colour = "yellow";
}
jQuery("#newsSummary").append("<div class='attackerInfo' style='text-align:right; color:"+ colour +"'>"+ attackers[i].attackerName + " "+ attackers[i].attCnt +" times, took: "+ attackers[i].land +"</div>");
}
}


}




if (currentPage.indexOf("market") > 0){
//Init settings
jQuery("table.contenttable tr").children("td:nth-child(7)").find("input").css({"width":"95px"});
jQuery("table.contenttable tr").children("td:nth-child(1)").each(function(){
jQuery(this).html(jQuery(this).html().replace("Military", "Mil."));
});
//jQuery(this).closest("tr").children("td:nth-child(7)").find("input").css({"width":"90px"});

var tempNum = 0;
var tempVal = 0;
var cashAmount = "";
var taxAdditive = 0;
if (jQuery(".mTax").length > 0){
taxAdditive = (jQuery(".mTax").html().replace("%", "").toLocaleString() / 100);
}else{
taxAdditive = 0;
}
var tax = 1 + taxAdditive;
jQuery("table.contenttable tr").has("td.lt").each(function(){
jQuery(this).find("td:nth-child(5), td:nth-child(6), td:nth-child(2)").hover(
function(){
tempNum = jQuery(this).html();
tempVal = jQuery(this).closest("tr").children("td:nth-child(7)").find("input").val();

cashAmount = "$" + Math.ceil((Math.round(jQuery(this).closest("tr").children("td:nth-child(3)").find("input").val()) * Math.round(jQuery(this).html().replace(",", "").replace(",", "").replace("$", "")) * tax)).toLocaleString();
//jQuery(this).html(cashAmount);
jQuery(this).closest("tr").children("td:nth-child(7)").find("input").val(cashAmount);

}, function(){
//jQuery(this).html(tempNum);
jQuery(this).closest("tr").children("td:nth-child(7)").find("input").val(tempVal);

}
).click(function(){
tempVal = jQuery(this).html(); //jQuery(this).closest("tr").children("td:nth-child(7)").find("input").val();
});
});
}

if (currentPage.indexOf("scores") > 0 || currentPage.indexOf("ranks") > 0 || currentPage.indexOf("clans") > 0){
var self = jQuery("td.c-own").html().split("(")[1].replace(")","");
var land = 0;
var networth = 0;
var perAcre = 0;
var rank = 0;
var selfPer = 0;
var selfLand = 0;
var selfNet = 0;
var selfRank = 0;

jQuery("p:contains('server.')").append(" <a target='_blank' href='http://www.eestats.com/';;;;;;;;;>EeStats</a>");

jQuery(".lt").each(function(){
if(jQuery(this).html().indexOf(self) > 1){
jQuery(this).css({"color":jQuery(this).find("td:nth-child(2)").css("color")});
selfRank = Math.round(jQuery(this).find("td:first").html());
document.title = "R:["+ selfRank +"]" + document.title;

jQuery(this).find(".rt").each(function(){
if (land === 0){
land = Math.round(jQuery(this).html().replace(",", "").replace(",", ""));
}else{
networth = Math.round(jQuery(this).html().replace(",", "").replace(",", "").replace("$", ""));
}
});
selfPer = Math.round(networth / land);
selfLand = Math.round(land);
selfNet = Math.round(networth);
}
});

jQuery(".lt").each(function(){
land = 0;
networth = 0;
perAcre = 0;
rank = 0;

jQuery(this).find("td:nth-child(2)").append(" ["+ jQuery(this).find(".ct").html() +"]");

rank = Math.round(jQuery(this).find("td:first").html());
jQuery(this).find(".rt").each(function(){
if (land === 0){
land = Math.round(jQuery(this).html().replace(",", "").replace(",", ""));
}else{
networth = Math.round(jQuery(this).html().replace(",", "").replace(",", "").replace("$", ""));
}
});
perAcre = Math.round(networth / land);
jQuery(this).find(".ct").html(perAcre);

if ((networth / 2) <= selfNet && (selfNet / 2) <= networth){
jQuery(this).find(".rt:eq(1)").css({"color":"yellow"});
//console.log(jQuery(this).find(".rt:eq(1)").html());
}
if (selfPer > (perAcre * 1.5)){
jQuery(this).find(".ct").css({"color":"red"});
}else if (selfPer > perAcre){
jQuery(this).find(".ct").css({"color":"yellow"});
}

if (((selfLand > land) && (selfRank > rank)) || ((selfLand < land) && (selfRank < rank))){
jQuery(this).find(".rt:first").css({"color":"red"});
}
});
}

if (currentPage.indexOf("research") > 0){
var tpt = Math.round(jQuery(".TPT").html().replace(/,/g, ''));
var curVal = 0.0;
var newVal = 0.0;
var tCount = 0;

jQuery(".turntable tr:nth-child(13)").find("td").append("<div id='tSpent' style='display:inline'></div>");
jQuery(".turntable tr.ct").each(function(){
if (jQuery(this).find("td input[value='Research Technology']").length == 0){
jQuery(this).find("td:nth-child(1)").click(function(evt){
curVal = Math.round(jQuery(this).closest("tr").find("input:text").val());
if(evt.ctrlKey){
mult = 5;
}else if(evt.altKey){
mult = 0.5;
}else{
mult = 1;
}
newVal = Math.floor(curVal + (tpt * mult));
tCount = tCount + mult;
jQuery(this).closest("tr").find("input:text").val(newVal);

jQuery("#tSpent").html(" ("+ tCount + ")");
});
}
});
}

if (currentPage.indexOf("build") > 0){
var bpt = Math.round(jQuery(".BPT").html());
var curVal = 0.0;
var newVal = 0.0;
var tCount = 0;

jQuery(".contenttable tr:nth-child(11)").find("td").append("<div id='tSpent' style='display:inline'></div>");
jQuery(".contenttable tr.rt").each(function(){
if (jQuery(this).find("td input[value='Construct Buildings']").length == 0){
jQuery(this).find("td:nth-child(1)").click(function(evt){
curVal = Math.round(jQuery(this).closest("tr").find("input:text").val());

if(evt.ctrlKey){
mult = 5;
}else if(evt.altKey){
mult = 0.5;
}else{
mult = 1;
}
newVal = Math.floor(curVal + (bpt * mult));
tCount = tCount + mult;
jQuery(this).closest("tr").find("input:text").val(newVal);

jQuery("#tSpent").html(" ("+ tCount + ")");
});
}
});

var totLand = 0;
jQuery(jQuery(".contenttable td.lt").next("td")).each(function(){
totLand += parseInt(jQuery(this).text());
});
totLand += parseInt(jQuery(".contenttable td:contains('Unused Land Area')").next("td").text().replace(" Acres","").replace(",","").replace(",",""));

jQuery(".contenttable").find("tr").each(function(i){
if (jQuery(this).find("th").length < 1){
jQuery(this).append("<td class='b"+ i +"'></td>");
}else{
jQuery(this).append("<th>"+ totLand +"</th>");
}
});

jQuery(jQuery(".contenttable td.lt, .contenttable td:contains('Unused Land Area')").next("td")).each(function(i){
if(parseInt(jQuery(this).text().replace(" Acres","").replace(",","").replace(",","")) > 0){
percB = (parseInt(jQuery(this).text().replace(" Acres","").replace(",","").replace(",","")) / totLand) * 100;
percB = percB.toFixed(2);
jQuery(".b"+(i+1)).text(percB + "%");
}
});

}
//end

Edited By: TheMafia on Dec 1st 2022, 22:30:17
See Original Post

TheMafia

Member
57

May 20th 2015, 4:48:39

FYI: i play in tournament where GDI is forced.

in the future i might add something where you can toggle that for games where GDI is optional

qzjul

Administrator
Game Development
10,197

May 20th 2015, 15:34:11

Looks nifty :)
Finally did the signature thing.

TheMafia

Member
57

May 20th 2015, 15:52:23

Thanks :) i was hoping you took it in a good way

Thanks for the edit!

mFrost

Member
325

May 20th 2015, 21:48:46

looks good, i do that same calc every now and then using earthgraphs.com to get country info.

I just have not found a way to get something useful out of this number, other than a perceived or potential strength of a country. Is it military or tech, is the military on hand leaning more to a defensive, or offensive stance. What kind of missile count does the country have or are they spy heavy.

ultimately what a country is doing internally based on their daily or turn by turn growth rate. it would need a look up table of sorts where based on land and various tech levels a production figure can be calculated, bounced against current market prices or a market bot to correlate sales and buys to amount of net gained or lost. a reverse engineering of sorts based on what can be seen publicly. it would not be 100%, but it could provide a set of weighted options as: most likely to least likely.

TheMafia

Member
57

May 21st 2015, 0:07:25

I use it merely as a reference and to keep an eye out for people that are gaining land too fast. I figured its a good targeting guide ive been using it to find the most potent land grabs. Its also a good judge of another player who is playing well, or just as you said a certain combination of strategies that produce suitability even with low net per acre. There is a player that has 700 per acre in my group that is 4 or 5th while others are still below or at 500.

I use the market a lot and i want a few calculations there too, so i will be adding that into this script.

TheMafia

Member
57

May 25th 2015, 13:53:31

The updated script is in the original post at the top

Version 2 is ready!

Market calculations added

When you mouse over the yellow columns, for any product, that amount is multiplied by the market value and displayed to you in the input field on the right. (i have stretched the field to fit billion dollar figures)

This applies to:
-Buy goods
-Buy Tech

Other changes:
Formatting of surrounding table cells to make sure it all fits neatly.

The updated script is in the original post at the top

Edited By: TheMafia on Sep 21st 2022, 0:05:26
See Original Post

qzjul

Administrator
Game Development
10,197

May 25th 2015, 19:34:41

that's a nifty idea; i like it :)
Finally did the signature thing.

now im nothing

Member
692

May 26th 2015, 1:58:35

Nice man I finally had a peek :)
less defined as days go by. Fading away well you might say I am losing the focus. Kinda drifting into the abstract in terms of how I see myself

TheMafia

Member
57

May 26th 2015, 16:49:17

:)

TheMafia

Member
57

Jun 1st 2015, 16:06:14

qzjul made a very good suggestion of what i can add to this script, with qzjul's help this change will be implemented within the next 7 days.

TheMafia

Member
57

Jun 15th 2015, 14:32:37

The updated script is in the original post at the top

Version 3 is now available!

New changes:
-Research tools have been created: http://tcpm.mrlazyinc.com/...onkey_script_research.PNG
-Both market and scores pages refresh on a 1 minute basis now
-Some changes to how the title displays in the browser, now shows: R:[Rank] (if available) T:(Turns) M:$Money
-Minor bug fixes

Next up:
-Buildings will get same treatment as research did

Special thanks goes out to qzjul on this one, he helped make this addition much easier to work on.

The updated script is in the original post at the top

Edited By: TheMafia on Sep 21st 2022, 0:05:12
See Original Post

TheMafia

Member
57

Jun 15th 2015, 19:41:31

Just an FYi about version 3, the research tools will be up and working soon, the script that is up is correct you will NOT have to update it to fix it, we are just waiting for a change on the server to go live.

sorry for the wait

TheMafia

Member
57

Jun 17th 2015, 13:42:33

Research is up and running, and qzjul informs me i can now do the same for buildings, you can expect that fairly soon

TheMafia

Member
57

Jun 25th 2015, 21:42:55

The updated script is in the original post at the top

Version 4:
-The buildings page now has the same functionality as the research page in version 3.

The updated script is in the original post at the top


Thanks again to qzjul for making this way easier for me!!

LittleItaly

Game Moderator
Alliance & FFA
2105

Jul 9th 2015, 4:28:39

How would I get this to work in firefox and greasemonkey? its not working sadly
LittleItaly
SOL Vet
-Discord: LittleItaly#2905
-IRC: irc.scourge.se #sol
-Apply today @ http://sol.ghqnet.com for Alliance

LittleItaly

Game Moderator
Alliance & FFA
2105

Jul 9th 2015, 4:38:46

Actually, there appears to be syntax errors. It is not working in Opera either.
LittleItaly
SOL Vet
-Discord: LittleItaly#2905
-IRC: irc.scourge.se #sol
-Apply today @ http://sol.ghqnet.com for Alliance

TheMafia

Member
57

Jul 13th 2015, 13:25:07

can you post the error?

there is perhaps another way of getting it to work with firefox, the errors might help me sort this out.

my prediction is the top includes section is different in firefox, ill try to make it work there.

LittleItaly

Game Moderator
Alliance & FFA
2105

Jul 14th 2015, 0:05:04

Doing a syntax check in tablemonkey in opera...

// @match *://http://www.earthempires.com/* seems just wrong to me. should probably be @match *earthempires.com/* ??
because if i type only earthempires.com to come to this website, then it does not add a http://

lines 22 and 23 missing semi colon

line 54 Extra semi colon

lines 128, 156 use === when comparing 0

Edited By: LittleItaly on Jul 14th 2015, 0:07:49
LittleItaly
SOL Vet
-Discord: LittleItaly#2905
-IRC: irc.scourge.se #sol
-Apply today @ http://sol.ghqnet.com for Alliance

LittleItaly

Game Moderator
Alliance & FFA
2105

Jul 14th 2015, 0:19:24

Making the above edits makes it work a bit

The research page is giving me NaN

The other pages seem to function as intended.

Well, is there a way to include more lines such as @match *earthempires.com/alliance* for each server?

The way I have it now will make the forums have T:()M displayed in my tab header since it is applying it to all earthempires.com pages.
LittleItaly
SOL Vet
-Discord: LittleItaly#2905
-IRC: irc.scourge.se #sol
-Apply today @ http://sol.ghqnet.com for Alliance

LittleItaly

Game Moderator
Alliance & FFA
2105

Jul 14th 2015, 1:17:24

the auto page refresh is annoying too
LittleItaly
SOL Vet
-Discord: LittleItaly#2905
-IRC: irc.scourge.se #sol
-Apply today @ http://sol.ghqnet.com for Alliance

TheMafia

Member
57

Jul 14th 2015, 13:28:13

Originally posted by LittleItaly:
Doing a syntax check in tablemonkey in opera...

// @match *://http://www.earthempires.com/* seems just wrong to me. should probably be @match *earthempires.com/* ??
because if i type only earthempires.com to come to this website, then it does not add a http://

lines 22 and 23 missing semi colon

line 54 Extra semi colon

lines 128, 156 use === when comparing 0


i literally just happen to fix that a few min before checking the post...syntax is updated

TheMafia

Member
57

Jul 14th 2015, 13:29:22

Originally posted by LittleItaly:
the auto page refresh is annoying too


feel free to remove it, but why are you sitting on the that refresh pages for more than a minute? they update so you have new figures to look at.

also you can turn them off if you like.

TheMafia

Member
57

Jul 14th 2015, 13:33:36

Originally posted by LittleItaly:
Doing a syntax check in tablemonkey in opera...

// @match *://http://www.earthempires.com/* seems just wrong to me. should probably be @match *earthempires.com/* ??
because if i type only earthempires.com to come to this website, then it does not add a http://

lines 22 and 23 missing semi colon

line 54 Extra semi colon

lines 128, 156 use === when comparing 0


=== is for objects most of the time you dont need it to compare any numbers even if its 0

nice spot on that extra semi colon

you seem to know what you are doing, you should have no trouble turning off the auto refresh

TheMafia

Member
57

Jul 14th 2015, 17:02:33

// @match *://*.earthempires.com/*
// @match *://earthempires.com/*


updated the matches to this to ensure all forms are covered

LittleItaly

Game Moderator
Alliance & FFA
2105

Jul 14th 2015, 21:48:45

All i did was use the built in syntax checker in the addon tampermonkey. I have not written anything in this language, and have not coded anything in a couple years now.

i dont know where the refresh is located. is it this?

var intv = setTimeout(function(){
var curPage = window.location.href;
window.location = curPage
}, 60000)

I am only guessing 60000 = the minute you mentioned.

i tend to sit on pages for long amounts of time as im doing other things.
LittleItaly
SOL Vet
-Discord: LittleItaly#2905
-IRC: irc.scourge.se #sol
-Apply today @ http://sol.ghqnet.com for Alliance

TheMafia

Member
57

Jul 16th 2015, 14:56:05

i have it refreshing market and scores, both of which has changing figures, if you sit on them i see benefit in refreshing.

unless you enter figures into fields and you lose them

TheMafia

Member
57

Jul 23rd 2015, 17:17:44

Version 4.5

Minor addition:
-Link to eeStats.com placed into scores page for easy access

updates in original post

zedsdead

New Member
2

Jul 29th 2015, 20:03:14

awesome!

TheMafia

Member
57

Aug 4th 2015, 19:10:04

thanks bro! :)

i was about to post to see how ppl are enjoying this

Zorp

Member
934

Aug 5th 2015, 3:00:13

It seems that the Market page doesn't factor in tax.

Nice job though!

Zorp

Member
934

Aug 6th 2015, 14:54:09

Bug:

Once you can tech more than 1k per turn, it fluffs the bed because of the comma that gets introduced, and will only put NaN into the tech amounts. On line ~125, this:

var tpt = Math.round(jQuery(".TPT").html());

should be replaced with this:

var tpt = Math.round(jQuery(".TPT").html().replace(/,/g, ''));

Zorp

Member
934

Aug 8th 2015, 6:23:48

In order to get the tax rate, this is how I figured it. I put this code into the "market" if statement:

var tax = jQuery('span[style*="font-size:10px"]').html();
if(tax===undefined){
tax = 0;
}else{
tax = tax.split("s a ")[1].split("%")[0];
}
tax=1+(tax/100);

So the if statement finds the %, then var tax becomes the multiple for the price.

Edited By: Zorp on Aug 8th 2015, 9:48:18
See Original Post

LittleItaly

Game Moderator
Alliance & FFA
2105

Aug 13th 2015, 2:40:49

if you get this to work in greasemonkey extension for firefox, then this is win. chrome and opera sucks.
LittleItaly
SOL Vet
-Discord: LittleItaly#2905
-IRC: irc.scourge.se #sol
-Apply today @ http://sol.ghqnet.com for Alliance

TheMafia

Member
57

Aug 13th 2015, 14:26:39

id say firefox sucks..... so really its best if it adapts to all....

let me rephrase that, firefox is literally the worst browser out there lol

TheMafia

Member
57

Aug 13th 2015, 14:26:53

Zorp, thanks for the input, will be adding those in

TheMafia

Member
57

Aug 13th 2015, 14:46:27

version 4.6 released

Changes:
-tech per turn over 1000 fixed, the comma no longer interrupts the process in the research page

Special thanks to Zorp for finding the bug and providing a solution


4.7 on the way, working with qzjul to make the up coming change cleaner

Marshal

Member
32,589

Aug 13th 2015, 19:33:32

i thought ie was worst browser.
Patience: Yep, I'm with ELK and Marshal.

ELKronos: Patty is more hairy.

Gallery: K at least I am to my expectations now.

LadyGrizz boobies is fine

NOW3P: Morwen is a much harsher mistress than boredom....

Zorp

Member
934

Aug 14th 2015, 1:28:11

I've got it to autoassign var self, so this is now truly cross server. Just remove "var self = ..." from the top and put this under the "scores" if statement with all the other variable declarations:

var self = jQuery("td.c-own").html().split("(")[1].replace(")","");

Zorp

Member
934

Aug 14th 2015, 6:20:54

I also removed " || currentPage.indexOf("ranks") > 0" from the scores if statement as it didn't seem to work properly for me anyhow, particularly on clan ranks pages.

TheMafia

Member
57

Aug 14th 2015, 19:40:18

Originally posted by Zorp:
I also removed " || currentPage.indexOf("ranks") > 0" from the scores if statement as it didn't seem to work properly for me anyhow, particularly on clan ranks pages.



can you paste a link for a clan rank page here? i dont play it myself

Zorp

Member
934

Aug 15th 2015, 6:10:31

LittleItaly

Game Moderator
Alliance & FFA
2105

Aug 20th 2015, 3:03:35

This script works in firefox w/ greasemonkey now... i think it didnt before because of the syntax errors that were fixed.

var self = jQuery("td.c-own").html().split("(")[1].replace(")",""); does not work for me.

i changed the @match pages so that it only works on ingame pages. Youll need to add more for the other servers...
// @match *://earthempires.com/alliance/*
// @match *://*.earthempires.com/alliance/*
LittleItaly
SOL Vet
-Discord: LittleItaly#2905
-IRC: irc.scourge.se #sol
-Apply today @ http://sol.ghqnet.com for Alliance

TheMafia

Member
57

Aug 24th 2015, 13:38:58

[quote poster=LittleItaly; 36196; 677001]This script works in firefox w/ greasemonkey now... i think it didnt before because of the syntax errors that were fixed.

var self = jQuery("td.c-own").html().split("(")[1].replace(")",""); does not work for me.

i changed the @match pages so that it only works on ingame pages. Youll need to add more for the other servers...
// @match *://earthempires.com/alliance/*
// @match *://*.earthempires.com/alliance/* [/quote]

i did it on purpose the way it is now

TheMafia

Member
57

Aug 24th 2015, 13:41:52



Where do you see this link? is it in the scores section and a subsection in it? or in the portal for EE?

TheMafia

Member
57

Aug 24th 2015, 14:06:23

Version 4.9 (testing for 5.0) Available

Changes:
-Market pages now include the tax into the quick calculations
-Player number is now dynamic and SHOULD grab your own number, especially when you have multiple accounts in diff servers

Testing:
-Clan pages should now be included in the 'Scores' quick calculations

Thanks to Zorp for testing
Thanks to LittleItaly for testing in FF/Greasemonkey

Marshal

Member
32,589

Aug 24th 2015, 14:31:24

portal, click top clans.
Patience: Yep, I'm with ELK and Marshal.

ELKronos: Patty is more hairy.

Gallery: K at least I am to my expectations now.

LadyGrizz boobies is fine

NOW3P: Morwen is a much harsher mistress than boredom....

LittleItaly

Game Moderator
Alliance & FFA
2105

Aug 26th 2015, 2:18:35

there is a bug in the war room. after grabbing at least... the attacking drop down list, it makes it go to the last item... so i accidentally declared war on two countries since it was scrolled to it... now it auto goes on missiles since that is my last item
LittleItaly
SOL Vet
-Discord: LittleItaly#2905
-IRC: irc.scourge.se #sol
-Apply today @ http://sol.ghqnet.com for Alliance

TheMafia

Member
57

Aug 26th 2015, 13:31:17

Originally posted by LittleItaly:
there is a bug in the war room. after grabbing at least... the attacking drop down list, it makes it go to the last item... so i accidentally declared war on two countries since it was scrolled to it... now it auto goes on missiles since that is my last item


ya, thats completely unrelated to this script. like why do you even think it would have anything to do with this? post this in the correct thread.

Marshal

Member
32,589

Aug 26th 2015, 13:47:40

li: that's normal, if you want it changed then tell it to qz.
Patience: Yep, I'm with ELK and Marshal.

ELKronos: Patty is more hairy.

Gallery: K at least I am to my expectations now.

LadyGrizz boobies is fine

NOW3P: Morwen is a much harsher mistress than boredom....