//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++