twelve27 User

I might have a temporary fix soon. I've gotten the troll battles working slightly. Need to recharge for another text and also test arena battles


Re: @MrKeeney:
They code for the arena has changed as well and has a different button as well. So it was not just troll battle that was changed.


Re: @ZugZwang:
The script should actually run just fine regardless of this. The same thing happens in my console as well and the scripts continue to work.


Re: @3jameo3:
That is the same matching line that I have manually added into every version of the script for myself and it seems to work just fine


3jameo3 has written auto missions and I have been messing around with it on my machine as well. Might be a good idea to bring it in so the three of us can work on hammering out the issues in it.


I didn't see that eileen is active again. Going to see if I can transplant the mission stuff into eileen's code since it also includes arena


The only time it messed up was when I set a busted console.log() in there. Otherwise, its been running fine. It ran all my missions while I was away. Of course it has the same issue as you and I have been researching, the pausing and waiting for a different screen to activate.


Re: @3jameo3:

I've done some editing around but not sure how much of my copy that I have changed or how much yours have changed so I'll post the mission snippets that have been running for me so far.

var getMission = function () {
  // console.log("Auto Missions Running");
  try {
    if ($('#breadcrumbs span').last().text() === 'Activities') {
      console.log('Detected mission screen. Accepting a mission');
      var buttonMatch = $('#missions button:not([style=\'display: none;\'])');
      var Accept = $('#missions button[rel^=\'mission_start\']:not([style=\'display: none;\'])');
      /*
      var Finish = $("#missions button[rel^='finish']:not([style='display: none;'])");
      var Present = $("#base_block #end_gift button:not([style='display: none;'])");*/
      //console.log(Present);
      if (buttonMatch.length === 0) {
        console.log('Could not find mission button.');
      }
      else if (Accept) {
        console.log('Starting mission.');
        Accept.click();
        sleep(100);
        document.cookie = 'nextActivityTime=;';
        window.location = window.location.origin;
      }
      /*
      else if (Finish) {
          console.log("Lets not click that.");
          //Finish.click();
      }
      else if (($("#base_block #end_gift")) && Present) {
          console.log("Claiming mission completion reward(s).");
          Present.click();
          sleep(100);
          window.location = window.location.origin;
      }
      */
      else {
        console.log('Could not identify given mission button.');
        sessionStorage.missionRequirement = 'unknownMissionButton';
      }
      sessionStorage.autoLoop = 'false';
      window.location = window.location.origin + $('nav div[rel=\'content\'] a:has(.activities)').attr('href');
    }
    else {
      // Not at Mission screen then goto the Mission screen.
      if (Cookies.get('nextActivityTime') === '0' || Cookies.get('nextActivityTime') === undefined || Cookies.get('nextActivityTime') === '' || (($('#home_missions_bar1 .text').length) === 0 && ($('#home_missions_bar2 .text').length) <= 2)) {
        console.log('Navigating to mission window.');
        sessionStorage.autoLoop = 'false';
        window.location = window.location.origin + $('nav div[rel=\'content\'] a:has(.activities)').attr('href');
        return;
      }
    }
  }
  catch (ex) {
    console.log('Could not do any missions... ' + ex);
  }
};
var collectMission = function () {
  // console.log("Auto Missions Running");
  try {
    if ($('#breadcrumbs span').last().text() === 'Activities') {
      console.log('Detected mission screen. Collecting mission(s)');
      var buttonMatch = $('#missions button:not([style=\'display: none;\'])');
      var Claim = $('#missions button[rel^=\'claim\']:not([style=\'display: none;\'])');
      var Groovy = $('#popups #mission_rewards button[rel^=\'groovy\']:not([style=\'display: none;\'])');

      if (buttonMatch.length === 0) { console.log('Could not find mission button.');}
      else if (Claim && (Cookies.get('nextActivityTime') <= 1)) {
        console.log('Claiming mission');
        Claim.click();
        document.cookie = 'nextActivityTime=;';
        sessionStorage.autoLoop = 'false';
        window.location = window.location.origin;
        return;
      }
      else if (click) {}
      else if (($('#popups #mission_rewards')) && Groovy) {
        console.log('Claiming mission reward(s).');
        Groovy.click();
        document.cookie = 'nextActivityTime=;';
      }
      else {
        console.log('Could not identify given mission button.');
        sessionStorage.missionRequirement = 'unknownMissionButton';
      }
    }
    else {
      // Not at Mission screen then goto the Mission screen.
      if (Cookies.get('nextActivityTime') === '0' || Cookies.get('nextActivityTime') === undefined || Cookies.get('nextActivityTime') === '' || (($('#home_missions_bar1 .text').length) === 0 && ($('#home_missions_bar2 .text').length) <= 2)) {
        console.log('Navigating to Mission window.');
        sessionStorage.autoLoop = 'false';
        window.location = window.location.origin + $('nav div[rel=\'content\'] a:has(.activities)').attr('href');
        return;
      }
    }
  }
  catch (ex) {
    console.log('Could not collect mission(s)... ' + ex);
  }
};

Re: @3jameo3:

Earlier today after my latest comment I implanted your new salary code into the script that I had going last night with the mission redirect. So at the very least I think I have it running for the most part from the home page. Currently I'm investigating the slow to start actions instead since the main components of salary and mission is working.

Also going to take a look to see if there is a way to get the koban collection at the end of daily missions to be fully functional. Of course I also want to look into the missions proceeding without needing salary to activate first.


Went to do a boss battle and it decided to suddenly grab the mission then. Not sure why though. Any clue?


Do your missions work with this current script? I was testing it out now and it seems missions aren't functioning. Might be a matter of my browser and cookies though


Re: @3jameo3:
Oh, you already fixed salary and updated? Nice. I actually just got up an hour ago and came to check on the script cause I forgot there was an update until a few minutes ago. Great, I'll test out the code as well. I figured their UI change would break the script. Later on I'll take a look at how we can move things faster or try to figure out why they take a while sometimes.

Okay, its hard to test the present box since it is once per day so it will probably take some time to debug anything that might arrive from that.


When the new missions rolled out tonight, it didn't grab it right away but rather after the next salary was grabbed. But it did return to the home screen after it got the mission so it seems like the snipped I have above is working properly. I'm wondering what to do about salary occasionally and missions frequently not activating and doing there actions right away.


So here is what I have in collectMission that has some slight changes:

if (buttonMatch.length === 0){ console.log("Could not find mission button.");}
      else if (Claim && (Cookies.get("nextActivityTime") <= 1)) {
        console.log("Claiming mission");
        Claim.click();
        document.cookie = "nextActivityTime=;";
        sessionStorage.autoLoop = "false";
        window.location = window.location.origin;
        return;
      }
      else if (click) {}
      else if (($("#popups #mission_rewards")) && Groovy) {
        console.log("Claiming mission reward(s).");
        Groovy.click();
        document.cookie = "nextActivityTime=;";
      }

adding in some brackets for the first if and removing the sleep statements. When the claim mission is clicked I go to window origin. Unfortunately I can't test more because I don't have missions available. But when I used this for the final mission I had left, it successfully went to the main page and got the time until the next mission. Come to think of it, I'm not sure if we need any sleep statements in the script.

Also, we'll need to make a change that clicks the groovy button when all missions are completed.


Re: @3jameo3:

A redirect to home would probably be the best option for undefined check because there is already multiple detection scenarios that happen on the home page. I'll test things as I can. I'm curious about what is not working about the script from a few days ago after you brought everything together. That is the version that I am still looking at at the moment.


Re: @3jameo3:
Hm, would a redirect of the user back to the last known page work then? Seems having the reward pop up and being stuck on the screen is causing the error. After claim reward is clicked, just go the previous page the user was at or back to the main screen and it should resolve the issue, right?


It is definitely the hardest to debug considering the amount of time between missions and how long it takes to recreate the conditions to test. We'll be able to solve it over time. I can't debug right now but I'll get to it when I can. My first thought is just that it might not be detecting the "groovy" button for the rewards properly. We'll see. Probably will have to put some debug or console.log() in there to see what is happening later.


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.


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.


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?



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.


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.


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)


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.