Jump to content

Script for Cave


MandaAde10000

Recommended Posts

I tried to strip all the extra stuff out.  If it is missing something necessary just let me know and i will regrab it but i just deleted the custom stuff i had in there.

 

 


var netProfit = 0
var errorCount = 0
var successCount = 0
var collectedAmount = 0;
var stopRequested = false;
var queuedGames = 0;
var payoutTotal = 0;
var payoutTotalX = 0;

function retry(delay)
{
    let profitStop = Number.parseFloat($('#txtStopProfit').val());
    
    if(profitStop > 0 && netProfit >= profitStop)
    {
        stopRequested = true;
    }

    if(!stopRequested)
    {
        return dg.handleBet().then(function(r)
        {
           
        }).catch(
        function(err){ console.log(err); return delayAsync(delay).then(retry(200))}
        )
    }
    else
    {
        queuedGames--;
        return;
    }
}


function delayAsync(timeMs)
{
    return new Promise(function(resolve){
        setTimeout(resolve, timeMs);
    });
}

async function bulkBet()
{
    stopRequested = false;

    let value = $('#txtNumBets').val();
    if(value=='' || value < '1')
    {
        value=1;
    }
    else
    {
        value = Number.parseInt(value);
    }
    await bulkBet2(value);
}

async function bulkBet2(numBets)
{
    let promises = [];
    
    let currentCount = 0;

    while(currentCount < numBets)
    {
        currentCount++;
        if(!stopRequested)
        {
            promises.push( retry(500));
            queuedGames++;
        }
    }
    
    return await Promise.all(promises);
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...