Maintain code sequence after refresh

Asked

Viewed 45 times

0

I would like to know how to maintain my command sequences after refreshing the page, because my javascript as soon as it is loaded acts as if it were the first time. The idea is to check a condition (Hp), refresh the page and click a button. Something like what the immaculate does.

var energy  =   Number(document.getElementById("infobar_energy").getElementsByClassName("infobar_line_value")[0].innerHTML.replace(" ","").replace("/ ","/").slice(0,document.getElementById("infobar_energy").getElementsByClassName("infobar_line_value")[0].innerHTML.replace(" ","").replace("/ ","/").indexOf('/')));
var server = 'https://s103-br.bitefight.gameforge.com';
if (energy > 0 ){
    if (window.location.href.includes("/humanhunt/humanHunt/2?__token=")){
        window.location.href = server + "/robbery/index"; 
    }
    if (window.location.href.includes("/humanhunt/index")){
        document.getElementsByClassName("btn-right")[3].getElementsByTagName('button')[0].click();
    }else{
        window.location.href = server + "/humanHunt/index"; 
    }
}
  • What would be this 'sequence of commands' ?

  • Have you used the immaculate? Basically it’s like following a cake recipe step by step, first a condition will arrive if the condition is true will follow the steps. When refreshing the page it will continue where it left off without checking the previous conditions

  • But is it an array? I imagine the solution is to save in coockies.

  • @Bananaz No, never used. You have the code you are using or have not made any code yet?

  • I made a quick script based on the game Bitefight, my idea is to check if there is energy, if there is then it will go to the link "/robbery/index", then will click on the hunting button and return to the fight page. however the only way I found it was this, check the link every time to make the next decision

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.