eileen12 / HaremHeroes Automatic

Re: @3jameo3:

I'm not sure what it returns nothing even if the collect button is not visible yet. For some reason the span is empty sometimes and

var CAB = $("#collect_all_bar .in").text();

evaluates to ""

Still looking into what the game is doing that it happens like that.

Basically we can add a couple lines of code to do this::

if (CAB === "" || CAB === undefined || CAB === 0) {
    getSalary();
}

That should failsafe into collecting if there is a need and also be able to refresh the page if there is nothing to collect.

Re: @3jameo3:
Good idea. Right now I'm testing out removing the "just in case" area you had in there.

// Just in case something goes wrong area
    var collect = ($('#collect_all').text().replace(/\s/g, ""));
    if (collect.length >= 18 && (Cookies.get("nextSalaryTime") === undefined ||Cookies.get("nextSalaryTime") === 0 || Cookies.get("nextSalaryTime") === "")) {
      document.cookie = "nextSalaryTime=";
      console.log("New fetch time stored in nextSalaryTime cookie.(+" + closestTime + " sec.)");
      console.log("Time to fetch salary.");
      getSalary();
      busy = true;
    }
    else {
      busy = false;
    }

and under the CAB check for including "s" I put

if (CAB.length === 0){
        console.log("Special time set");
        closestTime = 5;
      }

at the moment to test it. I think your line of code can replace my check on CAB length that I have.

Also we'll have to update the mission collection as well since it can give the undefined error as well (unless you already did that)

My missions is in an infinite loop atm. I like your idea as well.

Cool. I'll take a look at your other script later then to try and test it out once you do the updates. So far I'm still making sure salary runs properly with what I have. Seems so far so good with the removal of just in case and setting up those extra 5 seconds at times.

Re: @twelve27:

So far I've gotten missions and salary to work. I updated the complete script with the changes I have made but haven't updated the snippets yet. Testing out the idea I had on the salary function so far it seems to be running just fine.

Re: @3jameo3:
So far so good. The snippets I posted above have continued to function. Giving it that 5 seconds to check back seems to make it run just fine.

Re: @twelve27:

This is what I am running now its the same idea as yours just added more checks.

if ((CAB === undefined || CAB.length === 0) || (closestTime === undefined || closestTime === 0)) {
      closestTime = 5;
      getSalary();
      busy = true;
    }

The 5 seconds really does help a lot. I also fixed what was wrong with auto questing the money was not getting read right and the end_play button needed the same info as the pay button. You can check my complete script for the changes I made.

Re: @3jameo3:

Is autoMission working for you? I tested out your full script and all I got was an infinite loop. Does it requires the timer to have already been on the screen?

Looks like it does. I just looked at the console as I was turning the setting on and it seems it needs a timer there to activate so if someone tries to activate it when all missions are available and none are accepted yet, it wont work.

Wont have time for a while but I'll worn on debugging autoMission later. Seems to take a while before it actually tries to get a mission and has a chance to get stuck on the reward screen.

Re: @twelve27:
I'm actually having issues with it lets talk on my page for the script considering it doesn't concern this one.

still not working correctly.
i need to remove all cookies, then it collect all available salary, but then it stops collecting new one.

still not, in 2.3
it collect some salary, then come back to main page and stopped collecting

hmm.. still something wrong.. looks like when is counter for next salary as negative value, its stopped collecting
example for me it now collect some salary and when redirected to homepage, then it show another salary to collect (some miliseconds after collecting prevois salary), but not collecting anymore like it not see nothing to collect.

when arena battle enabled, its attacking players and troll at same time when you have focus + its repeately redirecting to Arena batlle until you click to attack any troll (possible only if you have haremheroes++), and it instantly attack him after opening attack page with him.

both battles cannot be enabled at once, but still if you enable arena battle it force you to atack troll but redirect to arena battle where you cannot attack troll (without hh++) and cannot disable arena battle there. (arena battle detect focus -> wrong)