hey guys! big thanks to @Skelefor the code, so the hashdice script now has a range that you can adjust yourself in the script before it starts betting minimum. i have also taken the time to change the stop-loss variables - there is now an option for it to stop the script or reset the martingale counter instead, and i have made it so that the stop-loss value is based x amount of bets you're able to double rather than a specific number you have to calculate yourself.
please let me know what you think!
var config = {
betPercentage: {
label: 'Total percentage of bankroll to bet',
value: 0.0015,
type: 'number'
},
lossesBeforeMinBet: {
label: 'Losses before minimum bet (range)',
value: 2-5,
type: 'text'
},
payout: {
label: 'payout',
value: 2,
type: 'number'
},
onLoseTitle: {
label: 'On Loss',
type: 'title'
},
onLoss: {
label: '',
value: 'increase',
type: 'radio',
options: [{
value: 'reset',
label: 'Return to base bet'
}, {
value: 'increase',
label: 'Increase bet by (loss multiplier)'
}
]
},
lossMultiplier: {
label: 'loss multiplier',
value: 2,
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,
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: currency.amount,
type: 'number'
},
lossStopAmount: {
label: 'Stop betting after losing this many times in a row without a win',
value: 1,
type: 'number'
},
loggingLevel: {
label: 'logging level',
value: 'compact',
type: 'radio',
options: [{
value: 'info',
label: 'info'
}, {
value: 'compact',
label: 'compact'
}, {
value: 'verbose',
label: 'verbose'
}
]
}
};
// deleted input parameters
var stop = 0;
var lossesForBreak = 0;
var roundsToBreakFor = 0;
// end deleted parameters
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 = 0;
function main() {
maxLossesBeforeMinBet = GetLossesBeforeMinBet(2-3);
function GetLossesBeforeMinBet()
{
if(config.lossesBeforeMinBet.value.toString().indexOf('-') >= 0)
{
var numbers = config.lossesBeforeMinBet.value.split('-');
return GetRandomInt(Number.parseInt(numbers[0]), Number.parseInt(numbers[1]));
}
else
{
return Number.parseInt(config.lossesBeforeMinBet.value);
}
}
// Returns a random integer between the min and max.
function GetRandomInt(min, max)
{
var retValue = Math.floor(Math.random() * (max - min)) + min;
log.info('Number of losses before pause is set to ' + retValue + '');
return retValue;
}
game.onBet = function () {
// if we are set to skip rounds then do so.
if (numberOfRoundsToSkip > 0) {
numberOfRoundsToSkip -= 1;
log.info('Skipping round to relax, and the next ' + numberOfRoundsToSkip + ' rounds.');
return;
} else {
if(totalNumberOfGames == 0)
{
// this is so we account for the first round.
currentBet = GetNewBaseBet();
}
if(loseStreak >= maxLossesBeforeMinBet)
{
if(game.history[0] >= (config.payout.value * 100))
{
loseStreak = 0;
maxLossesBeforeMinBet = GetLossesBeforeMinBet();
}
else
{
game.bet(currency.minAmount).then(function (payout) {
runningbalance -= currency.minAmount;
totalWagers += currency.minAmount;
totalNumberOfGames += 1;
if (payout > 1) {
var netwin = currency.minAmount * config.payout.value - currency.minAmount;
consequetiveLostBets = 0;
netProfit += netwin;
runningbalance += netwin + currency.minAmount;
loseStreak = 0;
maxLossesBeforeMinBet = GetLossesBeforeMinBet();
}
})
log.info('Betting minimum until a win hits');
return;
}
}
log.info('Placed bet for the amount of ' + currentBet);
game.bet(currentBet, config.payout.value).then(function (payout) {
runningbalance -= currentBet;
totalWagers += currentBet;
totalNumberOfGames += 1;
if (payout > 1) {
var netwin = currentBet * config.payout.value - currentBet;
consequetiveLostBets = 0;
if(config.loggingLevel.value != 'compact')
{
LogMessage('We won a net profit of: ' + netwin.toFixed(8), 'success');
}
netProfit += netwin;
runningbalance += netwin + currentBet;
if (loseStreak > 0) {
loseStreak = 0;
maxLossesBeforeMinBet = GetLossesBeforeMinBet();
}
currentStreak += 1;
totalWins += 1;
LogSummary('true', currentBet);
if (config.onWin.value === 'reset') {
currentBet = GetNewBaseBet();
} else {
currentBet *= config.winMultiplier.value;
}
LogMessage('We won, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'success');
} else {
log.error('We lost a net amount of: ' + currentBet.toFixed(8));
netProfit -= currentBet;
loseStreak += 1;
currentStreak = 0;
totalLoses += 1;
consequetiveLostBets += currentBet;
LogSummary('false', currentBet);
if (config.onLoss.value == 'reset') {
currentBet = GetNewBaseBet();
} else {
currentBet *= config.lossMultiplier.value;
}
LogMessage('We lost, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'failure');
}
if (currentStreak > longestWinStreak) {
longestWinStreak = currentStreak;
}
if (loseStreak > longestLoseStreak) {
longestLoseStreak = loseStreak;
}
recordStats();
if (config.winGoalAmount.value != 0 && netProfit > config.winGoalAmount.value) {
// we have earned enough stop and quit.
log.success('The net profits ' + netProfit.toFixed(8) + ' which triggers stop the for making enough.');
game.stop();
}
if (config.playOrStop.value === 'stop') {
if (config.lossStopAmount.value != 0 && config.lossStopAmount.value <= loseStreak && currentBet > currency.minAmount){
log.error('The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
game.stop();
}
}
if (config.playOrStop.value === 'continue') {
if (config.lossStopAmount.value != 0 && config.lossStopAmount.value <= loseStreak && currentBet > currency.minAmount){
log.error('The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
currentBet = GetNewBaseBet();
}
}
}
);
}
};
}
function recordStats() {
if (config.loggingLevel.value != 'compact') {
LogMessage('total wagers: ' + totalWagers.toFixed(8), 'info');
LogMessage('Net Profit: ' + netProfit.toFixed(8), 'info');
LogMessage('Current win streak: ' + currentStreak, 'info');
LogMessage('Current Lose streak: ' + loseStreak, 'info');
LogMessage('Total wins: ' + totalWins, 'info');
LogMessage('Total Losses: ' + totalLoses, 'info');
LogMessage('Longest win streak: ' + longestWinStreak, 'info');
LogMessage('Longest lose streak: ' + longestLoseStreak, 'info');
}
}
function GetNewBaseBet() {
var returnValue = 0;
returnValue = runningbalance * (config.betPercentage.value / 100);
if(returnValue > currency.minAmount)
{
LogMessage('Recalculating base bet to ' + returnValue.toFixed(8) + ' which is ' + config.betPercentage.value + ' percent of ' + runningbalance.toFixed(8), 'info');
}
else
{
LogMessage('The recalculated bet amount ' + returnValue.toFixed(8) + ' is lower than the minimum allowed bet. Setting bet to the minimum allowable amount of ' + currency.minAmount, 'info');
returnValue = currency.minAmount;
}
return returnValue;
}
function LogSummary(wasWinner, betAmount) {
if (config.loggingLevel.value == 'compact') {
if (wasWinner == 'true') {
var winAmount = (betAmount * config.payout.value) - betAmount;
log.success('Winner!! You won ' + winAmount.toFixed(8));
} else {
log.error('Loser!! You lost ' + betAmount.toFixed(8));
}
var winPercentage = (totalWins / totalNumberOfGames) * 100;
var losePercentage = (totalLoses / totalNumberOfGames) * 100;
log.info('Total Games: ' + totalNumberOfGames);
log.info('Wins: ' + totalWins + '(' + winPercentage.toFixed(2) + ' % )');
log.info('Loses: ' + totalLoses + '(' + losePercentage.toFixed(2) + ' % )');
var netNumber = runningbalance - originalbalance;
var netPecentage = (netNumber / originalbalance) * 100;
if (originalbalance < runningbalance) {
log.success('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
} else {
log.error('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
}
}
}
/// Determines whether or not to log an event or not to make it easier later
function LogMessage(message, loggingLevel) {
if (message) {
if (config.loggingLevel.value != 'compact') {
switch (loggingLevel) {
case 'success':
log.success(message);
break;
case 'failure':
log.error(message);
break;
case 'info':
log.info(message);
break;
case 'compact':
break;
case 'verbose':
if (isVerbose)
log.info(message);
break;
}
} else {
switch (loggingLevel) {
case 'success':
log.success(message);
break;
case 'failure':
log.error(message);
break;
case 'compact':
log.info(message);
break;
case 'info':
break;
case 'verbose':
break;
}
}
}
}