Forcewon Posted March 2, 2023 Share Posted March 2, 2023 im modified original martingale script, but i dont know howto add stop on win, anyone can help me please? var config = { percentageBet: { label: "base bet %", value: 0.0005, type: "number" }, payout: { label: "payout", value: 2.05, type: "number" }, stop: { label: "stop if next 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" }, }; //var var baseBet = currency.amount*(config.percentageBet.value/100); function main() { var currentBet = baseBet; game.onBet = function () { game.bet(currentBet, config.payout.value).then(function (payout) { if (payout > 1) { if (config.onWin.value === "reset") { currentBet = ((currentBet*config.payout.value)*0.001)+baseBet; } 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(); } }); }; } Link to comment Share on other sites More sharing options...
Cyls Posted March 2, 2023 Share Posted March 2, 2023 //you would need to create an input such that the desired stopping point. For example: var config = { winStop: //variable for stopping the game when we have won this much { label: 'Stop on Win Amount:', //GUI input for stopping on desired Win Amount value: currency.amount * 2, //just an example default value of double your starting balance type: 'number' }, } var netWin = 0; //variable to keep track of winnings throughout the game function main () { if (payout >1 ) { // says if the round has been won do.... netWin += currentBet * currentPayout; //we then need to keep track of winnings: } //each win add the win amount for the round to "netWin" //to have a running total of winnings else { //if we lost this round do............. netWin -= currentBet; //each round we lose we subtract the bet spent that round from our netWin total } //this way we account for coins spent and won to give an accurate value of winnings if (netWin >= config.winStop.value) { log.success ( ' Win Stop Amount Reached! Well Done! Stopping Game... ); log.sucess ( 'Win Stop Amount: ' + config.winStop.value + ' Current Net Win Balance: ' + netWin.toFixed(6) ); gameStop(); } } hope it helps. also if you need a nice code editing app I like NotePad++ Link to comment Share on other sites More sharing options...
Forcewon Posted March 6, 2023 Author Share Posted March 6, 2023 ty Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.