Jump to content

Crash script add-on to restart my crash script


Money_Magnet

Recommended Posts

Hey guys, I use a crash script but the problem is that sometimes it stops due to some random error like "Network error" or something like this. 

Do you any idea how can I implement a script that will check if my script is running and if it's not will start it? 

Link to comment
Share on other sites

Hope this will heple you.

function Auto_bet(){
var Run_btn = document.documentElement.innerHTML.includes('Run Script');

if(Run_btn == true ){
  document.querySelectorAll('div.button-inner')[2].click();
  var find_btn = "Confirm";
  var haystack = document.getElementsByClassName("button-inner");
  var i;

  for (i = 0; i < haystack.length; i++) {
    if(haystack[i].innerHTML == find_btn){
         console.log("Auto Start");
         haystack[i].click();
	}
  }
}
}


var Start_Auto_bet = setInterval(Auto_bet,1000);  


To cancel interval run this code or refesh your browser"

clearInterval(Start_Auto_bet);

 

Link to comment
Share on other sites

13 hours ago, rungxanhlv said:

Remélhetőleg ez segíteni fog neked.

function Auto_bet(){
var Run_btn = document.documentElement.innerHTML.includes('Run Script');

if(Run_btn == true ){
  document.querySelectorAll('div.button-inner')[2].click();
  var find_btn = "Confirm";
  var haystack = document.getElementsByClassName("button-inner");
  var i;

  for (i = 0; i < haystack.length; i++) {
    if(haystack[i].innerHTML == find_btn){
         console.log("Auto Start");
         haystack[i].click();
	}
  }
}
}


var Start_Auto_bet = setInterval(Auto_bet,1000);  


Az intervallum törléséhez futtassa ezt a kódot, vagy frissítse a böngészőt"

clearInterval(Start_Auto_bet);

 

Thanks the script. It work for me. 

But i change

document.querySelectorAll('div.button-inner')[2].click(); 

To

document.querySelectorAll('div.button-inner')[1].click();

Link to comment
Share on other sites

its much simpler than that

setInterval(function(){

if(!crash.script.isRunning)
{
         crash.script.start()
}

},
1000)

 

 

this essentialy is the same thing as click the start button if it is needed every 1 second.  This is assuming you don't have your script fail in some overly cataclysmic manner in which it isn't still setting on the script page waiting for it to be started again.

Link to comment
Share on other sites

14 hours ago, Skele said:

its much simpler than that

setInterval(function(){

if(!crash.script.isRunning)
{
         crash.script.start()
}

},
1000)

 

 

this essentialy is the same thing as click the start button if it is needed every 1 second.  This is assuming you don't have your script fail in some overly cataclysmic manner in which it isn't still setting on the script page waiting for it to be started again.

Thanks guys, this just shows how many different ways there is to code something

Link to comment
Share on other sites

On 2022. 04. 11. at 20:34, Skele said:

sokkal egyszerűbb ennél

setInterval(function(){

if(!crash.script.isRunning)
{
         crash.script.start()
}

},
1000)

 

 

ez a lényeg ugyanaz, mint a start gombra kattintás, ha 1 másodpercenként szükséges. Ez azt feltételezi, hogy a szkript nem hibásodik meg valami túlzottan kataklizmát okozó módon, amikor még mindig nincs beállítva a szkriptoldalon, és várja az újraindítást.

I use my script to hash dice. Your code good to hash dice? 

Link to comment
Share on other sites

for hash dice you will likely have to change the "crash" to be "hdg" but after that it should work.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...