Mosjfbiofwb Posted June 9, 2023 Share Posted June 9, 2023 (edited) I am trying to create a script that allows you to select a high/low betting pattern. is it possible to change this bet within the script? This is the script I have so far but I keep getting a system error when I try to run it. Note this script is also trying to allow a # of losses before minimum bet and stopping after a max loss. The number of loses before minimum bet is random based on a range you specify. 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 June 13, 2023 by Mosjfbiofwb additional info Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountAlready have an account? Sign in here.
Sign In Now