Jump to content

Fix script


DEATHWHITE
 Share

Recommended Posts

I get this script from forum but I can't run . Show error . Please fix for me

 

 

var config = {
    betPercentage: {
        label: 'Total percentage of bankroll to bet',
        value: 0.00015,
        type: 'number'
    },
    lossesBeforeMinBet: {
        label: 'Losses before minimum bet (range)',
        value: '10-20',
        type: 'text'
    },
    payout: {
        label: 'Payout',
        value: 3,
        type: 'number'
    },
    bettingPattern: {
        label: 'Betting Pattern',
        value: 'HLHL',
        type: 'text'
    },
    onLoseTitle: {
        label: 'On Loss',
        type: 'title'
    },
    onLoss: {
        label: '',
        value: 'increase',
        type: 'radio',
        options: [{
                value: 1.2,
                label: 'Return to base bet'
            }, {
                value: 'increase',
                label: 'Increase bet by (loss multiplier)'
            }
        ]
    },
    lossMultiplier: {
        label: 'Loss multiplier',
        value: 1.5,
        type: 'number'
    },
    onWinTitle: {
        label: 'On Win',
        type: 'title'
    },
    onWin: {
        label: '',
        value: 'reset',
        type: 'radio',
        options: [{
                value: 'reset',
                label: 'Return to base bet'
            }, {
                value: 'increase',
                label: 'Increase bet by (win multiplier)'
            }
        ]
    },
    winMultiplier: {
        label: 'Win multiplier',
        value: 1.2,
        type: 'number'
    },
    otherConditionsTitle: {
        label: 'Stop Settings',
        type: 'title'
    },
    playOrStop: {
        label: 'Once loss stop reached, continue betting (Martingale counter reset) or stop betting?',
        value: 'reset',
        type: 'radio',
        options: [{
                value: 'stop',
                label: 'Stop betting'
            }, {
                value: 'continue',
                label: 'Continue betting'
            }
        ]
    },
    winGoalAmount: {
        label: 'Stop once you have made this much',
        value: 1000000000,
        type: 'number'
    },
    lossStopAmount: {
         label: 'Stop betting after losing this much without a win.',
        value: 4,
        type: 'number'
    },
    loggingLevel: {
        label: 'Logging level',
        value: 'compact',
        type: 'radio',
        options: [{
                value: 'info',
                label: 'info'
            }, {
                value: 'compact',
                label: 'compact'
            }, {
                value: 'verbose',
                label: 'verbose'
            }
        ]
    }
};

var stop = 0;
var lossesForBreak = 0;
var roundsToBreakFor = 0;
var totalWagers = 0;
var netProfit = 0;
var totalWins = 0;
var totalLoses = 0;
var longestWinStreak = 0;
var longestLoseStreak = 0;
var currentStreak = 0;
var loseStreak = 0;
var numberOfRoundsToSkip = 0;
var currentBet = GetNewBaseBet();
var totalNumberOfGames = 0;
var originalbalance = currency.amount;
var runningbalance = currency.amount;
var consequetiveLostBets = 0;
var lossStopAmountVar = config.lossStopAmount.value;

function main() {
    console.log('Starting martingale...');}

engine.on('GAME_STARTING', function() {
    if (stop) {
        return;
    }
    
    if (numberOfRoundsToSkip > 0) {
        numberOfRoundsToSkip--;
        return;
    }

    if (lossStopAmountVar > 0 && currency.amount < originalbalance - lossStopAmountVar) {
        console.log('You have reached the loss stop amount. Stopping...');
        stop = 1;
        return;
    }

    if (config.winGoalAmount.value && currency.amount >= originalbalance + config.winGoalAmount.value) {
        console.log('You have reached the win goal. Stopping...');
        stop = 1;
        return;
    }

    var bet = Math.round(currentBet / 100) * 100;
    engine.bet(bet, config.payout.value);

    console.log('Betting', bet / 100, 'on', config.payout.value, 'x');

    totalNumberOfGames++;
    totalWagers += currentBet;
});

engine.on('GAME_ENDED', function() {
    var lastGame = engine.history.first();

    if (lastGame.wager) {
        totalWagers -= lastGame.wager;
    }

    if (lastGame.cashedAt) {
        netProfit += lastGame.wager * (lastGame.cashedAt - 1);
        totalWins++;
        currentStreak++;
        loseStreak = 0;
        if (currentStreak > longestWinStreak) {
            longestWinStreak = currentStreak;
        }

        if (config.onWin.value === 'reset') {
            currentBet = GetNewBaseBet();
        } else {
            currentBet *= config.winMultiplier.value;
        }
    } else {
        totalLoses++;
        loseStreak++;
        currentStreak = 0;
        if (loseStreak > longestLoseStreak) {
            longestLoseStreak = loseStreak;
        }

        if (config.onLoss.value === 'reset') {
            currentBet = GetNewBaseBet();
        } else {
            currentBet *= config.lossMultiplier.value;
        }
    }

    runningbalance += (lastGame.cashedAt ? lastGame.wager * (lastGame.cashedAt - 1) : -lastGame.wager);
    engine.emit('TOTAL_WAGER_UPDATE');
});

engine.on('TOTAL_WAGER_UPDATE', function() {
    var averageBetSize = totalWagers / totalNumberOfGames;
    var averageProfit = netProfit / totalNumberOfGames;
    console.log('***', engine.getBalance() / 100, '***', 'Avg Bet:', Math.round(averageBetSize) / 100, 'Total Games:', totalNumberOfGames, 'Net Profit:', Math.round(netProfit) / 100, 'Avg Profit:', Math.round(averageProfit) / 100, '***');
});

function GetNewBaseBet() {
    var returnValue = 0;
    
    // Get the bet percentage based on the current position in the pattern
    var bettingPattern = config.bettingPattern.value.toUpperCase();
    var patternIndex = totalNumberOfGames % bettingPattern.length;
    var betPercentage = (bettingPattern[patternIndex] === 'H') ? config.betPercentage.value : (config.betPercentage.value / 2);
    
    returnValue = runningbalance * (betPercentage / 100);
    
    var percentage = Math.floor(lossesForBreak / roundsToBreakFor * 100);
    
    if (percentage < config.lossesBeforeMinBet.value.split('-')[0]) {
        return Math.max(Math.round(returnValue), 100);
    } else if (percentage >= config.lossesBeforeMinBet.value.split('-')[1]) {
        return Math.max(Math.round(returnValue), 1000);
    } else {
        var minBet = 100;
        var maxBet = 1000;
        var difference = maxBet - minBet;
        var adjustedPercentage = (percentage - config.lossesBeforeMinBet.value.split('-')[0]) / (config.lossesBeforeMinBet.value.split('-')[1] - config.lossesBeforeMinBet.value.split('-')[0]);
        var adjustedBet = Math.round(adjustedPercentage * difference);
        return minBet + adjustedBet;
    }
}

console.log('Starting martingale...');

engine.on('GAME_STARTING', function() {
    console.log('Betting', currentBet / 100, 'bits...');
});

engine.on('GAME_ENDED', function() {
    var lastGame = engine.history.first();
    if (lastGame.cashedAt) {
        console.log('You won', (lastGame.wager * (lastGame.cashedAt - 1)) / 100, 'bits!');
        if (config.playOrStop.value === 'reset') {
            console.log('Resetting losses...');
            lossesForBreak = 0;
            roundsToBreakFor = 0;
            currentStreak = 0;
            numberOfRoundsToSkip = 0;
        }
    } else {
        console.log('You lost', lastGame.wager / 100, 'bits...');
        lossesForBreak += lastGame.wager / 100;
        roundsToBreakFor++;
        if (consequetiveLostBets >= 5) {
            numberOfRoundsToSkip = 2;
        }
        if (consequetiveLostBets >= 10) {
            numberOfRoundsToSkip = 3;
        }
        consequetiveLostBets++;
    }
});

console.log('Betting on', config.payout.value, 'x...');

main()

Edited by DEATHWHITE
Link to comment
Share on other sites

i already fixed this shitty attempt at combining two  scripts that weren't meant to be combined earlier today actually. but if you can't spot the numerous problems the thing is never going to work right for you.  lets start with, there are variables that aren't being set so they cause numerous divide by 0 errors all over the place.  Also in the range that is being split the results from a string.split is an array of strings.  Which are then used as if they are numbers causing other NaN errors.  There are references to objects that aren't going to exist if you use them outside of main. and yet main only has a write to the console in it. I mean the list goes on. But if you want a version that will at least run i will post it. 

 

var config = {
    betPercentage: {
        label: 'Total percentage of bankroll to bet',
        value: 0.00015,
        type: 'number'
    },
    lossesBeforeMinBet: {
        label: 'Losses before minimum bet (range)',
        value: '10-20',
        type: 'text'
    },
    payout: {
        label: 'Payout',
        value: 3,
        type: 'number'
    },
    bettingPattern: {
        label: 'Betting Pattern',
        value: 'HLHL',
        type: 'text'
    },
    onLoseTitle: {
        label: 'On Loss',
        type: 'title'
    },
    onLoss: {
        label: '',
        value: 'increase',
        type: 'radio',
        options: [{
                value: 1.2,
                label: 'Return to base bet'
            }, {
                value: 'increase',
                label: 'Increase bet by (loss multiplier)'
            }
        ]
    },
    lossMultiplier: {
        label: 'Loss multiplier',
        value: 1.5,
        type: 'number'
    },
    onWinTitle: {
        label: 'On Win',
        type: 'title'
    },
    onWin: {
        label: '',
        value: 'reset',
        type: 'radio',
        options: [{
                value: 'reset',
                label: 'Return to base bet'
            }, {
                value: 'increase',
                label: 'Increase bet by (win multiplier)'
            }
        ]
    },
    winMultiplier: {
        label: 'Win multiplier',
        value: 1.2,
        type: 'number'
    },
    otherConditionsTitle: {
        label: 'Stop Settings',
        type: 'title'
    },
    playOrStop: {
        label: 'Once loss stop reached, continue betting (Martingale counter reset) or stop betting?',
        value: 'reset',
        type: 'radio',
        options: [{
                value: 'stop',
                label: 'Stop betting'
            }, {
                value: 'continue',
                label: 'Continue betting'
            }
        ]
    },
    winGoalAmount: {
        label: 'Stop once you have made this much',
        value: 1000000000,
        type: 'number'
    },
    lossStopAmount: {
         label: 'Stop betting after losing this much without a win.',
        value: 4,
        type: 'number'
    },
    loggingLevel: {
        label: 'Logging level',
        value: 'compact',
        type: 'radio',
        options: [{
                value: 'info',
                label: 'info'
            }, {
                value: 'compact',
                label: 'compact'
            }, {
                value: 'verbose',
                label: 'verbose'
            }
        ]
    }
};

var stop = 0;
var lossesForBreak = 2;
var roundsToBreakFor = 2;
var totalWagers = 0;
var netProfit = 0;
var totalWins = 0;
var totalLoses = 0;
var longestWinStreak = 0;
var longestLoseStreak = 0;
var currentStreak = 0;
var loseStreak = 0;
var numberOfRoundsToSkip = 0;
var currentBet = 0;
var totalNumberOfGames = 0;
var originalbalance = 0;
var runningbalance = 0;
var consequetiveLostBets = 0;
var lossStopAmountVar = config.lossStopAmount.value;

function main() {

var originalbalance = currency.amount;
var runningbalance = currency.amount;
var currentBet = GetNewBaseBet();
    console.log('Starting martingale...');
    console.log('currentBet in main=' + currentBet);
    
engine.on('GAME_STARTING', function() {
    if (stop) {
        return;
    }
    
    if (numberOfRoundsToSkip > 0) {
        numberOfRoundsToSkip--;
        return;
    }

    if (lossStopAmountVar > 0 && currency.amount < originalbalance - lossStopAmountVar) {
        console.log('You have reached the loss stop amount. Stopping...');
        stop = 1;
        return;
    }

    if (config.winGoalAmount.value && currency.amount >= originalbalance + config.winGoalAmount.value) {
        console.log('You have reached the win goal. Stopping...');
        stop = 1;
        return;
    }

    console.log('currentBet in game_StartingEvent=' + currentBet);
    
    var bet = Math.round(currentBet / 100) * 100;
    engine.bet(bet, config.payout.value);

    console.log('Betting', bet / 100, 'on', config.payout.value, 'x');

    totalNumberOfGames++;
    totalWagers += currentBet;
});

engine.on('GAME_ENDED', function() {
    var lastGame = engine.history.first();

if (lastGame.wager) {
        totalWagers -= lastGame.wager;
    }

    if (lastGame.cashedAt) {
        netProfit += lastGame.wager * (lastGame.cashedAt - 1);
        totalWins++;
        currentStreak++;
        loseStreak = 0;
        if (currentStreak > longestWinStreak) {
            longestWinStreak = currentStreak;
        }

        if (config.onWin.value === 'reset') {
            currentBet = GetNewBaseBet();
        } else {
            currentBet *= config.winMultiplier.value;
        }
    } else {
        totalLoses++;
        loseStreak++;
        currentStreak = 0;
        if (loseStreak > longestLoseStreak) {
            longestLoseStreak = loseStreak;
        }

        if (config.onLoss.value === 'reset') {
            currentBet = GetNewBaseBet();
        } else {
            currentBet *= config.lossMultiplier.value;
        }
    }

    runningbalance += (lastGame.cashedAt ? lastGame.wager * (lastGame.cashedAt - 1) : -lastGame.wager);
    engine.emit('TOTAL_WAGER_UPDATE');
});

engine.on('TOTAL_WAGER_UPDATE', function() {
    var averageBetSize = totalWagers / totalNumberOfGames;
    var averageProfit = netProfit / totalNumberOfGames;
    console.log('*', engine.getBalance() / 100, '*', 'Avg Bet:', Math.round(averageBetSize) / 100, 'Total Games:', totalNumberOfGames, 'Net Profit:', Math.round(netProfit) / 100, 'Avg Profit:', Math.round(averageProfit) / 100, '***');
});

function GetNewBaseBet() {
    var returnValue = 0;
    
    // Get the bet percentage based on the current position in the pattern
    var bettingPattern = config.bettingPattern.value.toUpperCase();
    var patternIndex = totalNumberOfGames % bettingPattern.length;
    var betPercentage = (bettingPattern[patternIndex] === 'H') ? config.betPercentage.value : (config.betPercentage.value / 2);
    
    returnValue = runningbalance * (betPercentage / 100);
    
    console.log('runningbalance=' + runningbalance);
    console.log('betPercentage=' + betPercentage);
    console.log('returnValue=' + returnValue);
    console.log('patternIndex=' + patternIndex);
    
    var percentage = Math.floor(lossesForBreak / roundsToBreakFor * 100);
    var lossesBeforeMinBetLow = parseFloat(config.lossesBeforeMinBet.value.split('-')[0]);
    var lossesBeforeMinBetHigh = parseFloat(config.lossesBeforeMinBet.value.split('-')[1]);
    let retValue = 0;
    
    console.log("lossesForBreak=" + lossesForBreak);
    console.log("roundsToBreakFor=" + roundsToBreakFor);
    
    console.log("percentage=" + percentage);
    console.log("lossesBeforeMinBetLow=" + lossesBeforeMinBetLow);
    console.log("lossesBeforeMinBetHigh=" + lossesBeforeMinBetHigh);
    
    if (percentage < lossesBeforeMinBetLow) {
        retValue = Math.max(Math.round(returnValue), 100);
    } else if (percentage >= lossesBeforeMinBetHigh) {
        retValue = Math.max(Math.round(returnValue), 1000);
    } else {
        var minBet = 100;
        var maxBet = 1000;
        var difference = maxBet - minBet;
        var adjustedPercentage = (percentage - lossesBeforeMinBetLow) / (lossesBeforeMinBetHigh - lossesBeforeMinBetLow);
        var adjustedBet = Math.round(adjustedPercentage * difference);
        console.log("difference=" + difference);
        console.log("adjustedPercentage=" + adjustedPercentage);
        console.log("adjustedBet=" + adjustedBet);
        retValue = minBet + adjustedBet;
    }
    
    console.log('retValue=' + retValue);
    return retValue;
}

console.log('Starting martingale...');

engine.on('GAME_STARTING', function() {
    console.log('Betting', currentBet / 100, 'bits...');
});

engine.on('GAME_ENDED', function() {
    var lastGame = engine.history.first();
    if (lastGame.cashedAt) {
        console.log('You won', (lastGame.wager * (lastGame.cashedAt - 1)) / 100, 'bits!');
        if (config.playOrStop.value === 'reset') {
            console.log('Resetting losses...');
            lossesForBreak = 0;
            roundsToBreakFor = 0;
            currentStreak = 0;
            numberOfRoundsToSkip = 0;
        }
    } else {
        console.log('You lost', lastGame.wager / 100, 'bits...');
        lossesForBreak += lastGame.wager / 100;
        roundsToBreakFor++;
        if (consequetiveLostBets >= 5) {
            numberOfRoundsToSkip = 2;
        }
        if (consequetiveLostBets >= 10) {
            numberOfRoundsToSkip = 3;
        }
        consequetiveLostBets++;
    }
});

}

 

 

Also if you don't change the variables i set to the value 2 just to get this thing to work which i highlighted in white

then the line i highlighted in yellow will always be 100%, so you might want to trace the code and look at what this is actually doing.  All i did was debug the actual errors and make it run, i didn't fix or modify whatever the hell craziness was going on in the logic.

Link to comment
Share on other sites

MessageError: Insufficient balance.

Script is stopped!

 

Link to comment
Share on other sites

well perhaps you should put some money in your account or start with a lower bet size.  

Link to comment
Share on other sites

I have some deposit 

Screenshot_2023-10-31-23-07-50-1085956460.png

Link to comment
Share on other sites

You need to be a member in order to leave a comment

Sign up for a new account in our community. It's easy!

Register a new account

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...