jeudi 10 janvier 2019

Betting script improvement - Bet random

I'm trying to improve the following script by adding some randomness to it. Because right now it only bets on the "double_your_btc_bet_hi_button" id.

My idea is to generate a random number and make the bet based the its outcome. But I'm not sure how I supose to do that.

The id of the other bet buttom is "double_your_btc_bet_lo_button".

var minstake   = 0.00000001;  // valor base
var autorounds = 100;         // n° de rolls
var handbrake  = 0.0001;  // valor lose pause game
var autoruns   = 1;

function playnow() {
   if (autoruns > autorounds ) { console.log('Limit reached'); return; }
   document.getElementById('double_your_btc_bet_hi_button').click();
   setTimeout(checkresults, 123);
   return;}
function checkresults() {
   if (document.getElementById('double_your_btc_bet_hi_button').disabled === true) {
          setTimeout(checkresults, 246);
          return;
   }
   var stake = document.getElementById('double_your_btc_stake').value * 1;
   var won = document.getElementById('double_your_btc_bet_win').innerHTML;
   if (won.match(/(\d+\.\d+)/) !== null) { won = won.match(/(\d+\.\d+)/)[0]; } else { won = false; }
   var lost = document.getElementById('double_your_btc_bet_lose').innerHTML;
   if (lost.match(/(\d+\.\d+)/) !== null) { lost = lost.match(/(\d+\.\d+)/)[0]; } else { lost = false; }
   if (won && !lost) { stake = minstake; console.log('Bet #' + autoruns + '/' + autorounds + ': Won  ' + won  + ' Stake: ' + stake.toFixed(8)); }
   if (lost && !won) { stake = lost * 2.1; console.log('Bet #' + autoruns + '/' + autorounds + ': Lost ' + lost + ' Stake: ' + stake.toFixed(8)); }
   if (!won && !lost) { console.log('Something went wrong'); return; }
   document.getElementById('double_your_btc_stake').value = stake.toFixed(8);
   autoruns++;
   if (stake >= handbrake) {
          document.getElementById('handbrakealert').play();
          console.log('Handbrake triggered! Execute playnow() to override');
       return;
   }
   setTimeout(playnow, 111);
   return;

   }playnow()




Aucun commentaire:

Enregistrer un commentaire