Jump to content

Have a problem with script - assistance is appreciated


Abetor

Recommended Posts

I'm trying to make a script that will remember how many rounds have been lost and after specific round it'd multiply the bet, let's say I'd like to bet 1 JB 5 times, and if I lose them all, then it'd multiply the bet 5 times, or any other combination, but the thing is to remember how many rounds you've consecutively lost and multiply only after specific number of consecutive loses.

I've made the below script, but it keeps saying "SyntaxError: missing ) after argument list" when I try to run it, every argument seems to be closed with ), so I can't figure out where I'm wrong, and kindly ask for assistance. Also not sure how I should increment the losscount. also if anyone knows what language they're using (looks like javascript, but not quite and I'm not a programmer to recognize it really), or if there is a manual of any kind, that would also be appriciated.

Thanks all.
 

var config = {
  baseBet: { label: 'base bet', value: currency.minAmount * 1, type: 'number' },
  payout: { label: 'payout', value: 2, type: 'number' },
  stop: { label: 'stop if bet >', value: 1e8, type: 'number' },
  betsnum: { label: 'increase after loss number',value: 80, type: 'number'},
  losscount: {value: 0, 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;
  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') {
        currentBet = config.baseBet.value;
      } else {
        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 (config.losscount.value === config.betsnum.value) {
        currentBet *= config.lossMultiplier.value;
		config.losscount.value = 0;
      } else {config.losscount.value += 1;}
      log.error('We lost, so next bet will be ' + currentBet + ' ' + currency.currencyName + ' 'lossvalue' + config.losscount.value );
    }

    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

  • 4 weeks later...

Here is a brute force method of doing something similar to what you described.  It has no flexibility outside of changing the code as I didn't spend to much time on it.  Currently every five losses in a row will increase the bet by the loss multiplier.   It is reset by a win. This can maybe help you figure out how to program what you want by expanding on what is here.   Let me know if this helps.

 

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...