Jump to content

Crash Script HELP - Bounty for solution!


disorderlyNY

Recommended Posts

I'm trying to combine the functions of the regular Martingale script and the Payout Martingale script. So what I want to achieve On Lose, is to multiply the bet by a set amount AND increase the payout by a set amount. On win it would reset both 'base bet' and 'base payout'. I've combine the 2 scripts already but it is not functioning properly. Currently, on Win, the log is reporting both a "Win" and "Loss" and increasing the bet and payout. Also currently, On Lose, the log does not report anything and continues the existing bet and payout. The current combined script and and screenshot of the log is attached. Does anyone know how to fix this and make it function properly? Willing to tip anyone who can find the solution!!!

var config = {
  baseBet: { label: 'base bet', value: currency.minAmount * 1.2, type: 'number' },
  basePayout: { label: 'base payout', value: 2, type: 'number' },
  stop: { label: 'stop if bet >', value: 1e8, type: 'number' },
  onLoseTitle: { label: 'On Lose', type: 'title' },
  onLoss: { 
    label: '', value: 'increase', type: 'radio',
    options: [
      { value: 'reset', label: 'Return to base bet' },
      { value: 'increase', label: 'Increase bet by (loss multiplier)' },
	  { value: 'increase', label: 'Increase payout by (loss payout)' }
    ]
  },
  lossMultiplier: { label: 'loss multiplier', value: 2, type: 'number' },
  lossAdd: { label: 'loss payout +/-', value: 1, 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 and payout' },
	  { value: 'increase', label: 'Increase payout by (win payout)' }
    ]
  },
  winMultiplier: { label: 'win multiplier', value: 2, type: 'number' },
  winAdd: { label: 'win payout +/-', value: 1, type: 'number' },
}

function main () {
  var currentBet = config.baseBet.value;
  var currentPayout = config.basePayout.value;
  engine.on('GAME_STARTING', function () {
    engine.bet(currentBet, currentPayout);
  })

  engine.on('GAME_ENDED', function () {
    var history = engine.getHistory()
    var lastGame = history[0]
    // If we wagered, it means we played
    if (!lastGame.wager) {
      return;
    }

    // we won..
    if (lastGame.cashedAt) {
      if (config.onWin.value === 'reset') {
        currentBet = config.baseBet.value;
      } else {
        currentBet *= config.winMultiplier.value;
      }
	  if (config.onWin.value === 'reset') {
        currentPayout = config.basePayout.value;
      } else {
        currentPayout += config.winAdd.value;
      }
      log.success('We won, so next bet will be ' + currentBet + ' ' + currency.currencyName + ' at payout ' + currentPayout + ' x');
      if (config.onLoss.value === 'reset') {
        currentBet = config.baseBet.value;
      } else {
        currentBet *= config.lossMultiplier.value;
      }
	  if (config.onLoss.value === 'reset') {
        currentPayout = config.basePayout.value;
      } else {
        currentPayout += config.lossAdd.value;
      }
      log.error('We lost, so next bet will be ' + currentBet + ' ' + currency.currencyName + ' at payout ' + currentPayout + ' x');
    }

    if (currentBet > config.stop.value) {
      log.error('Was about to bet' + currentBet + 'which triggers the stop');
      engine.stop();
    }
  })
}

The screenshot of the log below is only 3 bets. First is the initial bet which won. The log says the bet both won and lost. The second bet was increased even though it should have stayed. The second bet lost, but nothing was changed or mentioned in the log. Instead, the third bet was placed at the existing bet and payout which makes so sense to me, because it should have either reset or increased. Please help!!!!

9ea16a7517557f7ad8b26e2e99808e04.png

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

Archived

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

×
×
  • Create New...