Hello, I need to modify this code so that in case of loss, the bet amount is doubled, and when the bet wins, it returns to the value of the doubled bet in case of original win, as the original bet
meaning if you win two bets and the bet is 10 USD, it increases each time by 1 USD to become the total bet 12
and the third time, suppose you lose the bet, it makes the bet 12, and let's assume the bet wins, the code returns to the bet 12 and does not increase to become 24 USD
var config = {
baseBet: { label: "base bet", value: currency.minAmount, type: "number" },
payout: { label: "payout", value: 2, type: "number" },
stop: { label: "stop if next bet >", value: 1e8, type: "number" },
onLoseTitle: { label: "On Lose", type: "title" },
onLoss: {
label: "",
value: "reset",
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;
game.onBet = function () {
game.bet(currentBet, config.payout.value).then(function (payout) {
if (payout > 1) {
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 {
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"
);
game.stop();
}
});
};
}