Jump to content

Wait X reds.


carlomaxs

Recommended Posts

Hello friends, I have a strategy to play in the crash, but I need to complete this script, but I don't understand anything about programming, I would just like to add a routine that it expects x reds in the quote I choose, which I will define and from there I start to bet, I believe that this code already has almost everything, just need to add that. Can someone help me? Sorry my english, is google translator.

 

var config = {
  baseBet: { label: 'base bet', value: currency.minAmount * 1.2, type: 'number' },
  payout: { label: '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)' }
    ]
  },
  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: 2, type: 'number' },
}

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

  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') {
     lossCount = 0;        
        currentBet = config.baseBet.value;
      } else {
     lossCount = 0;
        currentBet *= config.winMultiplier.value;
      }
      log.success('We won, so next bet will be ' + currentBet + ' ' + currency.currencyName);
    } else {
      if (config.onLoss.value === 'reset') {
        currentBet = config.baseBet.value;
      } else if (lossCount > 4) {
             lossCount = 1;    
             currentBet = currentBet;         
          } else {
      lossCount = lossCount + 1;
          if (lossCount > 4) currentBet *= config.lossMultiplier.value;       
      }
      log.error('We lost, so next bet will be ' + currentBet + ' ' + currency.currencyName);
    }

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

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...