Jump to content

NEW Crash Script - with a shit load of options


Dinscore
 Share

Recommended Posts

The get history has always loaded the previous 20 rolls. The only way to load more is to get from verification site which is beyond me.
It grabs those 20 previous rolls because that's 20 more than just pressing Start and we want to see some sort of pattern before betting.

It now adjusts the bet according to losses.

The Update won't show correct Profit as the ability to call the currency.amount returns the same amount as when the script 1st started.

To me this is old and spaghetti looking with crap all over it. This style of betting based upon losses generates a certain level of profit, but is not even close to basing bets on the Streaks % and pausing betting when no streaks.

 

//******************* Nubs27's Smart Script for Crash  *******************
//
//
//
// If you find this script helpful please consider donating to Nubs27 or tipping on NanoGames.io:
// Referral Link: https://n-luzqe.nanogames.io/
//
// Donations accepted in many coin/token types. List & Addresses:
// https://sites.google.com/view/nanogamescrashscripts/home/donation-addresses
//
//
//
var config = {
    mainTitle: { label: '*** Nubs27\'s Smart Script for Crash ***', type: 'title' },
    auto: { label: '', value: 'Script', type: 'radio', options: [
           { value: 'Script', label: 'Script chooses Base Bet'},
           { value: 'Player', label: 'Player chooses Base Bet'} ]},
    bet: { label: 'Base Bet', value: currency.minAmount, type: 'number' },
    lossTitle: { label: 'Stop When ', type: 'title' },
    stop: { label: 'Coins Lost >', value: 1, type: 'number' },
    end: { label: 'Minutes >', value: 250, type: 'number' },
    profit: { label: 'Profit >', value: 100, type: 'number' },
};

function main () {
//PayOuts checked in the Stats Update
const MultiplierArray = [2.5, 3.00, 5.00, 6.00, 7.00];
const LMultiplierArray = [10.00, 20.00, 50.00, 100.00];
var version = "v2.3";
var PayOutPercents = [];
var PayOutConfidence = [];
var Array2Filter = [];
var FilteredArray = [];
var ScriptHistory = [];
var Trains = []; // Red Train IDs - finding gaps between & correlation between gap & duration
var History = [];
var RoundsPlayed = 0;
var RoundsViewed = 0;
var LastGameID = 1;
var CurrentGameID = LastGameID + 1;
var MinimumBet = currency.minAmount;
var MaxBet = (currency.amount / 10);
var TotalBets = 0;
var CurrentMultiplier = MultiplierArray[1];
var LastMultiplier = MultiplierArray[1];
var MaxLossesEncountered = 3;
var MostLost = 0;
var LargestMulitplier = 2;
var BaseBet = config.bet.value;
var CurrentBet = BaseBet;
var LastBet = BaseBet;
var LastShrek = CurrentGameID;
var LastTrain = 0;
var Gap = 0;
var AverageGap = 0;
var LargestBet = [0,0];
var Enable100ID = 1000000;
var LastResult = "Won";
var CoinLost = 0;
var StopLossCoin = config.stop.value;
var Losses = 0;
var Wins = 0;
var Red = 0;
var Green = 0;
var StartTime = new Date();
var EndTime = new Date();
var TimeDiff = (EndTime - StartTime);
var StartBalance = currency.amount;
var EndBalance = 0;
var Profit = 0;
var ATHProfit = 0;
var ProfPerMin = 0;
var NetProfit = 0;
var DisplayGreeting = "False";
var GotHistory = "False";
var BetYet = "False";
var LoggedBetData = "False";
var GameInfoLogged = "False";
var StrategyFound = "False";
var IsPlaying = "False";
var UpdateBets = "False";
var Enable100 = "False";
var LastCrash = 0;
var PrevCashOut = 0;
var WonAmount = 0;
var FindThisMultiplier = 1;
var FindShouldHave = 2;
var ThisAverage = 1;
var HistorySlice = 50;
var Paused = "True";
var IndexMax = PayOutConfidence[0];
var MaxIndex = 0;
var GetNumber = 0;

// Welcome the Player to the Script
console.clear();
engine.on('GAME_STARTING', function () {
    if (DisplayGreeting == "False") {
        log.info('     Nubs27s Smart Script for Crash');
        log.info("      ****************");
        log.info("See Web Console for more Information (Press F12)");
        console.log('%c~~~~~~~~~~~~~~~~~ Nubs27\'s Smart Script for Crash ~~~~~~~~~~~~~~~~~','color:Purple; font-weight:bold');
        console.log('%cScript Start Time: ' + StartTime,'color:Purple; font-weight:200');
        console.log('  %cWelcome ' , 'color:Purple; font-weight:bold');
        console.log('  %cYour Starting Balance is: ' + StartBalance + ' ' + currency.currencyName, 'color:Purple; font-weight:bold');
        if (config.auto.value == 'Player') {
            if (config.stop.value > currency.amount) {
                MaxBet = (currency.amount / 10);
                config.stop.value = currency.amount * 0.98;
                console.log('%c[WARNING]: Stop Loss is above your Bankroll','color:Orange; font-weight:bold');
                console.log('%c[WARNING]: Stop Loss Updated to ' + config.stop.value, 'color:Orange; font-weight:bold');
            }
            if (config.bet.value > (config.stop.value / 15000)) {
                log.info('[WARNING]: Script Recommends a bankroll of at least ' + (BaseBet * 15000) + '' + currency.currencyName + ' for the Base Bet you provided');
                log.info('[WARNING]: Script Recommends a bankroll of at least ' + (BaseBet * 20000) + '' + currency.currencyName + ' for the Base Bet you provided');
                log.info('[WARNING]: Script Recommends a bankroll of at least ' + (BaseBet * 25000) + '' + currency.currencyName + ' for the Base Bet you provided');
            }
            console.log('  %cYou Input: ' + BaseBet + ' ' + currency.currencyName + ' as the Base Bet', 'color:Purple; font-weight:bold');
        }else{
            betupdate();
            console.log('  %cYour Starting Base Bet is: ' + BaseBet + ' ' + currency.currencyName, 'color:Purple; font-weight:bold');
        }
        console.log('  %cYour Stoppers are: Coin Lost > ' + config.stop.value + '; Minutes > ' + config.end.value + '; Profit > ' + config.profit.value, 'color:Purple; font-weight:bold');
        console.log('%c~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~','color:Purple; font-weight:bold');
        if (config.stop.value > currency.amount) {
            MaxBet = (currency.amount / 10);
            config.stop.value = currency.amount * 0.95;
            console.log('%c[WARNING]: Stop Loss Updated to ' + config.stop.value, 'color:Orange; font-weight:bold');
        }
    }
    DisplayGreeting = "True";
    if (GotHistory == "False") {
        getnanohistory();
        GotHistory = "True";
        console.log(ScriptHistory);
        LastShrek = [];
        LastTrain = [];
    }
//
//
//
//Everything above here only runs 1 time
    console.log(' ----------------------------');
    CurrentGameID = (LastGameID + 1);
    console.log('[Round ID]: ' + CurrentGameID);
    if (StrategyFound == "False") {
        strategy();
    }
//Checks User Parameters for Stopping Script
    checkstoppers();
    CurrentBet = BaseBet;
    MaxIndex = Math.floor(Math.random() * MaxIndex);
    CurrentMultiplier = GetNumber;
    CurrentBet = (CoinLost  + BaseBet) / CurrentMultiplier;
    checkbet();
    if (BetYet == "False") {
        engine.bet(CurrentBet, CurrentMultiplier);
        console.log("[Betting] " + CurrentBet.toFixed(7) + " at " + CurrentMultiplier + "x");
        log.info("[Betting] " + CurrentBet.toFixed(7) + " at " + CurrentMultiplier + "x");
    }
    BetYet = "True";
});
function getnanohistory() {
    History = engine.getHistory();
    for (i = 0; i < History.length; i++) {
        ScriptHistory.push(History.crash / 100);
        RoundsViewed++;
    }
}
function strategy() {
// Is there a Payout with a 80% Confidence or Higher? If not, pause.
    findconfidence();
// Which Payout has highest confidence based upon history & math?
    findlargestindex();
//    console.log('[Index] ' + '(' + MaxIndex + ')' + ' PayOut: ' + MultiplierArray[MaxIndex] + ' [Largest Confidence] ' + PayOutConfidence[MaxIndex]);
//    console.log(' PayOut ' + MultiplierArray[MaxIndex] + '; Confidence Level ' + PayOutConfidence[MaxIndex] + ' %');
    GetNumber = MultiplierArray[MaxIndex];
// Randomize the PayOut
    randompayout();
//    console.log('[Get Number] is: ' + GetNumber);
    checkforstreaks();
    CurrentMultiplier = GetNumber;
    StrategyFound = "True";
// Which Payout has highest confidence based upon streakiness of rounds?
}
function randompayout() {
    if (LastResult == "Lost" && CurrentMultiplier > 1.98) {
        GetNumber = (CurrentMultiplier * 0.95);
    }else if (LastResult =="Lost") {
        GetNumber = (CurrentMultiplier * 1.25);
    }
    GetNumber = GetNumber * 100;
    GetNumber = Math.floor(Math.random() * GetNumber) + 211;
    GetNumber = GetNumber / 100;
    if (isNaN(GetNumber)) {
        GetNumber = Math.floor(Math.random() * 311) + 251;
        GetNumber = GetNumber / 100;
    }
}
function checkforstreaks() {
    threeafterthree();
    minitrains();
    prevpayouts();
    htrains();
    tens();
//    hundred();
    HistorySlice = 50;
}
function tens() {
    FindThisMultiplier = 9.99;
    HistorySlice = 10;
    historyfilter();
    if (FilteredArray.length > 2) {
        CurrentBet = BaseBet;
        CurrentMultiplier = 3.11;
        console.log('[Bet Adjustment] PayOut +10x = ' + FilteredArray.length);
    }
}
function hundred() {
    FindThisMultiplier = 69;
    HistorySlice = 100;
    historyfilter();
    if (Enable100 == "True" && (CurrentGameID - Enable100ID) > 25) {
        Enable100 = "False";
    }
    if (Enable100 == "True" && LastResult == "Won") {
        Enable100 = "False";
    }
    if (FilteredArray.length === 0) {
        if (Enable100 == "True") {
            CurrentMultiplier = 88.00;
            CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
            console.log('Manadory run at 100x');
        }
    }
}
function historyfilter() {
    Array2Filter = ScriptHistory.slice(0,[HistorySlice]);
    FilteredArray = Array2Filter.filter(function (e) {
        return e > FindThisMultiplier;
    });
}
function htrains() {
    if (Red > 5) {
        CurrentMultiplier = Math.floor(Math.random() * 311) + 199;
        CurrentMultiplier = CurrentMultiplier / 100;
        CurrentBet = ((CoinLost + BaseBet) / (CurrentMultiplier - 1));
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Reds > 5');
    }
    if (Red > 9) {
        CurrentMultiplier = Math.floor(Math.random() * 488) + 235;
        CurrentMultiplier = CurrentMultiplier / 100;
        CurrentBet = ((CoinLost + BaseBet) / (CurrentMultiplier - 1));
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Reds > 5');
    }
}
function prevpayouts() {
    if (ScriptHistory[0] > 5.00 || ScriptHistory[1] > 5.00 || ScriptHistory[2] > 5.00) {
        CurrentMultiplier = Math.floor(Math.random() * 299) + 233;
        CurrentMultiplier = CurrentMultiplier / 100;
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] 5x in last 3 rounds');
    }
    if (LastResult == "Won") {
        CurrentMultiplier = Math.floor(Math.random() * 311) + 215;
        CurrentMultiplier = CurrentMultiplier / 100;
        GetNumber = CurrentMultiplier;
        CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
    }

}
function minitrains() {
    if (Green > 3 && LastResult == "Lost") {
        CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
        CurrentMultiplier = 2.14;
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Green x3 & Loss');
    }
    if (Green > 3 && LastResult == "Won") {
        CurrentBet = BaseBet;
        CurrentMultiplier = 3.11;
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Green x3 & Won');
    }
    if (Red > 3 || Green > 3) {
        CurrentMultiplier = Math.floor(Math.random() * 311) + 199;
        CurrentMultiplier = CurrentMultiplier / 100;
        CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Red/Green x3');
    }
}
function threeafterthree () {
    if (ScriptHistory[0] > 2.99 && ScriptHistory[1] > 2.99 && ScriptHistory[2] > 2.99) {
        if ((CurrentGameID - LastTrain) > 15 && (CurrentGameID - LastShrek > 10)) {
            if (LastResult == "Won") {
                CurrentBet = BaseBet * 2;
                CurrentMultiplier = 2.14;
                GetNumber = CurrentMultiplier;
                console.log('[Bet Adjustment] 3x after 3 rounds & Won');
            }
            if (LastResult == "Lost") {
                CurrentMultiplier = Math.floor(Math.random() * 288) + 211;
                CurrentMultiplier = CurrentMultiplier / 100;
                CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
                GetNumber = CurrentMultiplier;
                console.log('[Bet Adjustment] 3x after 3 rounds & Lost');
            }
        }
    }
    
}
function findconfidence() {
    PayOutConfidence = [];
    for (i = 0; i < PayOutPercents.length; i++) {
        if (PayOutPercents < 100) {
            PayOutConfidence = (100 - PayOutPercents);
            PayOutConfidence = Math.abs(PayOutConfidence);
            PayOutConfidence = (PayOutConfidence + 25);
        }else if (PayOutPercents == 100) {
            PayOutConfidence = 25;
        }else{
            PayOutConfidence = 0;
        }
        if (i > 3) {
            PayOutConfidence = (PayOutConfidence - 25);
        }
        if (i > 5) {
            PayOutConfidence = (PayOutConfidence - 25);
        }
        if (PayOutConfidence < 0) {
            PayOutConfidence = 0;
        }
    }
}
function findlargestindex() {
    IndexMax = PayOutConfidence[0];
    MaxIndex = 0;
    for (var i = 1; i < PayOutConfidence.length; i++) {
        if (PayOutConfidence >= IndexMax) {
            MaxIndex = i;
            IndexMax = PayOutConfidence;
        }
    }
}

function checkbet() {
    MinimumBet = currency.minAmount;
    BaseBet = config.bet.value;
//Check bet against player bankroll --- For what parameters???
//Check bet against site bankroll  - is there enough to win all we want?
    if (CurrentBet < BaseBet) {
        CurrentBet = BaseBet;
    }
    if (CurrentBet < MinimumBet) {
        CurrentBet = MinimumBet;
    }      
    if (CurrentBet > MaxBet) {
        CurrentBet = MaxBet;
        console.log('[Bet Adjustment] Survive Losses');
    }
    if (CurrentBet > currency.maxAmount) {
        CurrentBet = currency.maxAmount;
        MaxBet = currency.maxAmount / 5;
        console.log('[Bet Adjustment] Maximum Bet allowed by platform');
    }
    if (CurrentBet > LargestBet[0]) {
        LargestBet[0] = CurrentBet;
        LargestBet[1] = CurrentMultiplier;
    }
}
engine.on('GAME_ENDED', function (data) {
    console.log(data);
    RoundsViewed++;
    PrevCashOut = data.crash / 100;
    LastGameID = data.gameId;
    if (GameInfoLogged == "False") {
        loglastcrash(data);
    }
    updateplayer();
    updatestats();
    CurrentGameID = CurrentGameID.toString();
    if (CurrentGameID.endsWith('0')) {
        console.log(version);
        console.log('%c~~Nov~~~~ Update Completed ~~~~2019~~','color:blue;font-weight:bold');
        log.info('~~Nov~~~~ Update Completed ~~~~2019~~');
        log.info(version);
    }
    if (UpdateBets == "True" && LastResult == "Won") {
        betupdate();
        UpdateBets = "False";
    }
    BetYet = "False";
    StrategyFound = "False";
    LoggedBetData = "False";
    Paused = "False";
});
function loglastcrash(data) {
    if (PrevCashOut > LargestMulitplier) {
        LargestMulitplier = PrevCashOut;
    }
    if (PrevCashOut < 2.01) {
        Red++;
        Green = 0;
        if (Red == 6) {
            if (LastTrain === 0) {
                Trains = [];
            }
            Trains.unshift(CurrentGameID);
            Gap = CurrentGameID - LastTrain;
            AverageGap = (AverageGap + Gap) / Trains.length;
            console.log('Logging Round ' + CurrentGameID + ' as H Train');
            console.log('Average Gap ' + AverageGap + ' between H Trains');
            log.info('Logging Round ' + CurrentGameID + ' as H Train');
            console.log('Gap from last H Train ' + Gap + ' rounds');
            log.info('Gap from last H Train ' + Gap + ' rounds');
            LastTrain = CurrentGameID;
        }
    }else{
        Green++;
        Red = 0;
        if (Green == 6) {
            LastShrek = CurrentGameID;
            console.log('Logging Round ' + CurrentGameID + ' as Shrek');
            log.info('Logging Round ' + CurrentGameID + ' as Shrek');
        }
    }
    if (CoinLost > MostLost) {
        MostLost = CoinLost;
    }
    if (ScriptHistory.unshift(PrevCashOut) > 999) ScriptHistory.pop();
//Check for if round was played
    if (data.wager > 0) {
        TotalBets = TotalBets + CurrentBet;
        data.wager = CurrentBet;
        IsPlaying = "True";
        winorlose(data);
        RoundsPlayed++;
        LastBet = CurrentBet;
        LastMultiplier = CurrentMultiplier;
    }else{
        LastResult = "Not Played";
    }
}
function winorlose (data) {
    if (data.cashedAt > 0) {
        WonAmount = ((CurrentBet * CurrentMultiplier) - CoinLost - CurrentBet);
        Profit = Profit + WonAmount;
        LastResult = "Won";
        Wins++;
        Losses = 0;
        if (Profit > ATHProfit) {
            ATHProfit = Profit;
            CoinLost = 0;
        }else{
            CoinLost = ATHProfit - Profit;
        }
        log.info("[Profit] " + WonAmount);
        console.log('%c[Result] Round Won. ' + 'Net Profit of ' + WonAmount.toFixed(7),'color:green');
    }else{
        LastResult = "Lost";
        Losses++;
        Wins = 0;
        CoinLost = CoinLost + CurrentBet;
        console.log('%c[Result] Round ' + LastResult,'color:red');
        log.info('Round Lost');
    }
    if (Losses > MaxLossesEncountered) {
        MaxLossesEncountered = Losses;
        console.log("Encountered Streak of " + Losses + " Losses Before Win");
        log.info("Encountered Streak of " + Losses + " Losses Before Win");
    }
    if (Losses > 3) {
        console.log('%c[Coin Lost] Cumulative Since Last Win: ' + CoinLost.toFixed(7),'color:red');
        log.info('%c[Coin Lost] Cumulative Since Last Win: ' + CoinLost.toFixed(7));
    }
}
function updatestats() {
    //Lists PayOuts under 10x for last 50 rounds
    for (i = 0; i < MultiplierArray.length; i++) {
        FindThisMultiplier = MultiplierArray;
        FindMultiplierHistory();
        PayOutPercents = ThisAverage;
    }
    //Lists PayOuts 10x and over for last 100 rounds
    if (RoundsViewed > 100) {
        HistorySlice = 100;
        CurrentGameID = CurrentGameID.toString();
        if (CurrentGameID.endsWith('0')) {
            console.log("In the last " + HistorySlice + " rounds there was: ");
        }
        for (i = 0; i < LMultiplierArray.length; i++) {
            FindThisMultiplier = LMultiplierArray;
            FindMultiplierHistory();
        }
    }
//    console.log(PayOutPercents);
}
function FindMultiplierHistory() {
    FindThisMultiplier = (FindThisMultiplier - 0.01);
    Array2Filter = ScriptHistory.slice(0,[HistorySlice]);
    FilteredArray = Array2Filter.filter(function (e) {
        return e > FindThisMultiplier;
        });
    FindThisMultiplier = (FindThisMultiplier + 0.01);
    DisplayTimesSeen();
    findpercents();
}
function DisplayTimesSeen() {
    FindShouldHave = (Array2Filter.length / FindThisMultiplier);
    FindShouldHave = (FindShouldHave * 100);
    FindShouldHave = Math.round(FindShouldHave);
    FindShouldHave = (FindShouldHave / 100);
    CurrentGameID = CurrentGameID.toString();
    if (CurrentGameID.endsWith('0')) {
        console.log("PayOuts " + FindThisMultiplier + "x & Higher " + Math.round(FindShouldHave) + " times. There were " + FilteredArray.length);
    }
}
function findpercents() {
    ThisAverage = FilteredArray.length / Math.round(FindShouldHave);
    ThisAverage = (ThisAverage * 100);
    ThisAverage = Math.round(ThisAverage);
}
function updateplayer() {
    EndBalance = currency.amount;
    NetProfit = EndBalance - StartBalance;
    var ProfitPercent = (NetProfit / StartBalance) * 100;
    EndTime = new Date();
    TimeDiff = ((EndTime - StartTime) / 1000 )/ 60;
    ProfPerMin = (Profit / TimeDiff);
    CurrentGameID = CurrentGameID.toString();
    if (CurrentGameID.endsWith('0')) {
        console.log(" ");
        log.info(" ");
        console.log('%c~~~~~~~~~~ NubsScript Update ~~~~~~~~~~','color:blue;font-weight:bold');
        log.info('~~~~~  NubsScript Update  ~~~~~');
        figuretime();
        console.log("Begining Bank " + StartBalance.toFixed(7) + " Current Bank " + currency.amount.toFixed(7) + " " + currency.currencyName);
        log.info("Begining Bank " + StartBalance.toFixed(7) + " Current Bank " + currency.amount.toFixed(7) + " " + currency.currencyName);
        console.log("Current Base Bet: " + config.auto.value + " "+ BaseBet  + " " + currency.currencyName);
        log.info("Current Base Bet: " + BaseBet + " " + currency.currencyName);
        console.log("Session Net Profit " + NetProfit.toFixed(7) + ' ' + currency.currencyName + " or " + ProfitPercent.toFixed(2) + "% ");
        log.info("Session Net Profit " + NetProfit.toFixed(7) + ' ' + currency.currencyName + " or " + ProfitPercent.toFixed(2) + "% ");
        console.log("Profit Per Minute " + ProfPerMin.toFixed(7) + ' ' + currency.currencyName);
        log.info("Profit Per Minute " + ProfPerMin.toFixed(7) + ' ' + currency.currencyName);
        console.log("Highest PayOut Seen: " + LargestMulitplier + "x");
        log.info("Highest PayOut Seen: " + LargestMulitplier + "x");
        console.log("Cumulative Amount Bet: " + TotalBets.toFixed(7) + " " + currency.currencyName);
        log.info("Cumulative Amount Bet: " + TotalBets.toFixed(7) + " " + currency.currencyName);
        console.log("Biggest Bet Placed " + LargestBet[0] + " at " + LargestBet[1] + "x");
        log.info("Biggest Bet Placed " + LargestBet[0] + " at " + LargestBet[1] + "x");
        console.log("Largest Loss: " + MostLost.toFixed(7) + " " + currency.currencyName + " on " + MaxLossesEncountered + " consecutive losses");
        log.info("Largest Loss: " + MostLost.toFixed(7) + " " + currency.currencyName + " on " + MaxLossesEncountered + " consecutive losses");
        if (Trains.length > 2) {
            console.log("Hilarious Train IDs:");
            console.log(Trains);
        }
        console.log("In the last " + HistorySlice + " rounds there was: ");
    }
    RoundsViewed = RoundsViewed.toString();
    if (RoundsViewed.endsWith('00') && config.auto.value == "Script") {
        UpdateBets = "True";
    }
}
function figuretime() {
// get total seconds between the times
var delta = Math.abs(StartTime - EndTime) / 1000;
// calculate (and subtract) whole days
var days = Math.floor(delta / 86400);
delta -= days * 86400;
// calculate (and subtract) whole hours
var hours = Math.floor(delta / 3600) % 24;
delta -= hours * 3600;
// calculate (and subtract) whole minutes
var minutes = Math.floor(delta / 60) % 60;
delta -= minutes * 60;
// what's left is seconds
var seconds = delta % 60;  // in theory the modulus is not required
if (days > 0) {
    console.log("Viewed " + RoundsViewed + " Rounds in " + days + " days " + hours + " hours " + minutes + " minutes");
    log.info("Viewed " + RoundsViewed + " Rounds in " + days + " days " + hours + " hours " + minutes + " minutes");
}else if (hours > 0) {
    console.log("Viewed " + RoundsViewed + " Rounds in " + hours + " hours " + minutes + " minutes");
    log.info("Viewed " + RoundsViewed + " Rounds in " + hours + " hours " + minutes + " minutes");
}else{
    console.log("Viewed " + RoundsViewed + " Rounds in " + minutes + " minutes");
    log.info("Viewed " + RoundsViewed + " Rounds in " + minutes + " minutes");
}
}
function checkstoppers() {
    if (TimeDiff > config.end.value && LastResult == "Won") {
        log.info("Stopped Due to User Parameters (Minutes)");
        console.log("Stopped Due to User Parameters (Minutes)");
        engine.stop();
    }
    if (Profit > config.profit.value && LastResult == "Won") {
        log.info("Stopped Due to User Parameters (Profit)");
        console.log("Stopped Due to User Parameters (Profit)");
        engine.stop();
    }
    if (CoinLost > StopLossCoin) {
        log.info("Stopping Due to User Parameters");
        console.log("Stopping Due to User Parameters (Coin Lost)");
        engine.stop();
    }
}
function betupdate() {
    BaseBet = currency.amount / 15000;
    if (BaseBet < currency.minAmount) {
        BaseBet = currency.minAmount;
        console.log("Bankroll too small. Attempting script by user's command");
    }
    config.bet.value = BaseBet;
    MaxBet = (currency.amount / 10);
    config.stop.value = currency.amount * 0.98;
    console.log('%c[WARNING]: Stop Loss Updated to ' + config.stop.value, 'color:Orange; font-weight:bold');
    console.log('%c[WARNING]: Base Bet Updated to ' + BaseBet, 'color:Orange; font-weight:bold');
}
}

Link to comment
Share on other sites

I've actually been using the first script in this thread for a couple days with pretty good results. However, it requires a deep pocket to cover for those 13/14 straight loss streaks. 

Is there a way to potentially modify it to take the quickest "win" that it can after the 10th loss or so in order to reset the loss counter? Not sure if that even makes sense - but it would help to have fewer "safety rolls" at the end and would end the losing streak ASAP.

Link to comment
Share on other sites

On 1/23/2022 at 10:37 AM, NubsScripts said:

...

@NubsScripts
Heyas, just wanted to post a thank you for the script you posted.  I've tried a few in this thread to varying degrees of success.  I've been trying yours out today and have been doing nicely with the little bit I have left in my account.  I'm starting to think I might recoup the $1500 I tried out here. 😅
If there's anything else you have interesting for us to try out, I'm sure folks would be appreciative.  Anyway, have a blessed day and thanks again. 

Link to comment
Share on other sites

On 1/23/2022 at 10:37 AM, NubsScripts said:

 

 

//******************* Nubs27's Smart Script for Crash  *******************
//
//
//
    

Thank you very much.

Link to comment
Share on other sites

On 1/23/2022 at 10:37 AM, NubsScripts said:

but is not even close to basing bets on the Streaks % and pausing betting when no streaks.

Do you have any scripts that can do that?  Basing bets on the Streaks % and pausing betting when no streaks.

 

Edit: 
Also, do you know if its possible to switch high/low while running a script in hash dice? 
Thanks for everything!

 

Edited by Jamiekson
Link to comment
Share on other sites

  • 4 weeks later...
On 1/6/2022 at 6:47 AM, NubsScripts said:

Yes this thread is a little old but hopefully you all are still around. I'm going to post a script from 3 years ago. I'm pretty sure the responses from server have changed so it won't run. However, this script will change the payout based upon the board. At one point it ran on ng for almost 30 days straight without interruption. Documented and posted screenshots along the way. Started with free 0.005 Eth from spider back then and got it up to 0.89 Eth and then I got scared and shut it down.

 

//******************* Nubs27's Smart Script for Crash  *******************
//
//
//
// If you find this script helpful please consider donating to Nubs27 or tipping on NanoGames.io:
// Referral Link: https://n-luzqe.nanogames.io/
//
// Donations accepted in many coin/token types. List & Addresses:
// https://sites.google.com/view/nanogamescrashscripts/home/donation-addresses
//
//
//
var config = {
    mainTitle: { label: '*** Nubs27\'s Smart Script for Crash ***', type: 'title' },
    auto: { label: '', value: 'Script', type: 'radio', options: [
           { value: 'Script', label: 'Script chooses Base Bet'},
           { value: 'Player', label: 'Player chooses Base Bet'} ]},
    bet: { label: 'Base Bet', value: currency.minAmount, type: 'number' },
    lossTitle: { label: 'Stop When ', type: 'title' },
    stop: { label: 'Coins Lost >', value: 1, type: 'number' },
    end: { label: 'Minutes >', value: 250, type: 'number' },
    profit: { label: 'Profit >', value: 100, type: 'number' },
};

function main () {
//PayOuts checked in the Stats Update
const MultiplierArray = [2.5, 3.00, 5.00, 6.00, 7.00];
const LMultiplierArray = [10.00, 20.00, 50.00, 100.00];
var version = "v2.3";
var PayOutPercents = [];
var PayOutConfidence = [];
var Array2Filter = [];
var FilteredArray = [];
var ScriptHistory = [];
var Trains = []; // Red Train IDs - finding gaps between & correlation between gap & duration
var History = [];
var RoundsPlayed = 0;
var RoundsViewed = 0;
var LastGameID = 1;
var CurrentGameID = LastGameID + 1;
var MinimumBet = currency.minAmount;
var MaxBet = (currency.amount / 10);
var TotalBets = 0;
var CurrentMultiplier = MultiplierArray[1];
var LastMultiplier = MultiplierArray[1];
var MaxLossesEncountered = 3;
var MostLost = 0;
var LargestMulitplier = 2;
var BaseBet = config.bet.value;
var CurrentBet = BaseBet;
var LastBet = BaseBet;
var LastShrek = CurrentGameID;
var LastTrain = 0;
var Gap = 0;
var AverageGap = 0;
var LargestBet = [0,0];
var Enable100ID = 1000000;
var LastResult = "Won";
var CoinLost = 0;
var StopLossCoin = config.stop.value;
var Losses = 0;
var Wins = 0;
var Red = 0;
var Green = 0;
var StartTime = new Date();
var EndTime = new Date();
var TimeDiff = (EndTime - StartTime);
var StartBalance = currency.amount;
var EndBalance = 0;
var Profit = 0;
var ATHProfit = 0;
var ProfPerMin = 0;
var NetProfit = 0;
var DisplayGreeting = "False";
var GotHistory = "False";
var BetYet = "False";
var LoggedBetData = "False";
var GameInfoLogged = "False";
var StrategyFound = "False";
var IsPlaying = "False";
var UpdateBets = "False";
var Enable100 = "False";
var LastCrash = 0;
var PrevCashOut = 0;
var WonAmount = 0;
var FindThisMultiplier = 1;
var FindShouldHave = 2;
var ThisAverage = 1;
var HistorySlice = 50;
var Paused = "True";
var IndexMax = PayOutConfidence[0];
var MaxIndex = 0;
var GetNumber = 0;

// Welcome the Player to the Script
console.clear();
engine.on('GAME_STARTING', function () {
    if (DisplayGreeting == "False") {
        log.info('     Nubs27s Smart Script for Crash');
        log.info("      ****************");
        log.info("See Web Console for more Information (Press F12)");
        console.log('%c~~~~~~~~~~~~~~~~~ Nubs27\'s Smart Script for Crash ~~~~~~~~~~~~~~~~~','color:Purple; font-weight:bold');
        console.log('%cScript Start Time: ' + StartTime,'color:Purple; font-weight:200');
        console.log('  %cWelcome ' , 'color:Purple; font-weight:bold');
        console.log('  %cYour Starting Balance is: ' + StartBalance + ' ' + currency.currencyName, 'color:Purple; font-weight:bold');
        if (config.auto.value == 'Player') {
            if (config.stop.value > currency.amount) {
                MaxBet = (currency.amount / 10);
                config.stop.value = currency.amount * 0.98;
                console.log('%c[WARNING]: Stop Loss is above your Bankroll','color:Orange; font-weight:bold');
                console.log('%c[WARNING]: Stop Loss Updated to ' + config.stop.value, 'color:Orange; font-weight:bold');
            }
            if (config.bet.value > (config.stop.value / 15000)) {
                log.info('[WARNING]: Script Recommends a bankroll of at least ' + (BaseBet * 15000) + '' + currency.currencyName + ' for the Base Bet you provided');
                log.info('[WARNING]: Script Recommends a bankroll of at least ' + (BaseBet * 20000) + '' + currency.currencyName + ' for the Base Bet you provided');
                log.info('[WARNING]: Script Recommends a bankroll of at least ' + (BaseBet * 25000) + '' + currency.currencyName + ' for the Base Bet you provided');
            }
            console.log('  %cYou Input: ' + BaseBet + ' ' + currency.currencyName + ' as the Base Bet', 'color:Purple; font-weight:bold');
        }else{
            betupdate();
            console.log('  %cYour Starting Base Bet is: ' + BaseBet + ' ' + currency.currencyName, 'color:Purple; font-weight:bold');
        }
        console.log('  %cYour Stoppers are: Coin Lost > ' + config.stop.value + '; Minutes > ' + config.end.value + '; Profit > ' + config.profit.value, 'color:Purple; font-weight:bold');
        console.log('%c~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~','color:Purple; font-weight:bold');
        if (config.stop.value > currency.amount) {
            MaxBet = (currency.amount / 10);
            config.stop.value = currency.amount * 0.95;
            console.log('%c[WARNING]: Stop Loss Updated to ' + config.stop.value, 'color:Orange; font-weight:bold');
        }
    }
    DisplayGreeting = "True";
    if (GotHistory == "False") {
        getnanohistory();
        GotHistory = "True";
        console.log(ScriptHistory);
        LastShrek = [];
        LastTrain = [];
    }
//
//
//
//Everything above here only runs 1 time
    console.log(' ----------------------------');
    CurrentGameID = (LastGameID + 1);
    console.log('[Round ID]: ' + CurrentGameID);
    if (StrategyFound == "False") {
        strategy();
    }
//Checks User Parameters for Stopping Script
    checkstoppers();
    CurrentBet = BaseBet;
    MaxIndex = Math.floor(Math.random() * MaxIndex);
    CurrentMultiplier = GetNumber;
    CurrentBet = ((CoinLost + BaseBet) / CurrentMultiplier - 1);
    checkbet();
    if (BetYet == "False") {
        engine.bet(CurrentBet, CurrentMultiplier);
        console.log("[Betting] " + CurrentBet.toFixed(7) + " at " + CurrentMultiplier + "x");
        log.info("[Betting] " + CurrentBet.toFixed(7) + " at " + CurrentMultiplier + "x");
    }
    BetYet = "True";
});
function getnanohistory() {
    History = engine.getHistory();
    for (i = 0; i < History.length; i++) {
        ScriptHistory.push(History.crash / 100);
        RoundsViewed++;
    }
}
function strategy() {
// Is there a Payout with a 80% Confidence or Higher? If not, pause.
    findconfidence();
// Which Payout has highest confidence based upon history & math?
    findlargestindex();
//    console.log('[Index] ' + '(' + MaxIndex + ')' + ' PayOut: ' + MultiplierArray[MaxIndex] + ' [Largest Confidence] ' + PayOutConfidence[MaxIndex]);
//    console.log(' PayOut ' + MultiplierArray[MaxIndex] + '; Confidence Level ' + PayOutConfidence[MaxIndex] + ' %');
    GetNumber = MultiplierArray[MaxIndex];
// Randomize the PayOut
    randompayout();
//    console.log('[Get Number] is: ' + GetNumber);
    checkforstreaks();
    CurrentMultiplier = GetNumber;
    StrategyFound = "True";
// Which Payout has highest confidence based upon streakiness of rounds?
}
function randompayout() {
    if (LastResult == "Lost" && CurrentMultiplier > 1.98) {
        GetNumber = (CurrentMultiplier * 0.95);
    }else if (LastResult =="Lost") {
        GetNumber = (CurrentMultiplier * 1.25);
    }
    GetNumber = GetNumber * 100;
    GetNumber = Math.floor(Math.random() * GetNumber) + 211;
    GetNumber = GetNumber / 100;
    if (isNaN(GetNumber)) {
        GetNumber = Math.floor(Math.random() * 311) + 251;
        GetNumber = GetNumber / 100;
    }
}
function checkforstreaks() {
    threeafterthree();
    minitrains();
    prevpayouts();
    htrains();
    tens();
//    hundred();
    HistorySlice = 50;
}
function tens() {
    FindThisMultiplier = 9.99;
    HistorySlice = 10;
    historyfilter();
    if (FilteredArray.length > 2) {
        CurrentBet = BaseBet;
        CurrentMultiplier = 3.11;
        console.log('[Bet Adjustment] PayOut +10x = ' + FilteredArray.length);
    }
}
function hundred() {
    FindThisMultiplier = 69;
    HistorySlice = 100;
    historyfilter();
    if (Enable100 == "True" && (CurrentGameID - Enable100ID) > 25) {
        Enable100 = "False";
    }
    if (Enable100 == "True" && LastResult == "Won") {
        Enable100 = "False";
    }
    if (FilteredArray.length === 0) {
        if (Enable100 == "True") {
            CurrentMultiplier = 88.00;
            CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
            console.log('Manadory run at 100x');
        }
    }
}
function historyfilter() {
    Array2Filter = ScriptHistory.slice(0,[HistorySlice]);
    FilteredArray = Array2Filter.filter(function (e) {
        return e > FindThisMultiplier;
    });
}
function htrains() {
    if (Red > 5) {
        CurrentMultiplier = Math.floor(Math.random() * 311) + 199;
        CurrentMultiplier = CurrentMultiplier / 100;
        CurrentBet = ((CoinLost + BaseBet) / (CurrentMultiplier - 1));
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Reds > 5');
    }
    if (Red > 9) {
        CurrentMultiplier = Math.floor(Math.random() * 488) + 235;
        CurrentMultiplier = CurrentMultiplier / 100;
        CurrentBet = ((CoinLost + BaseBet) / (CurrentMultiplier - 1));
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Reds > 5');
    }
}
function prevpayouts() {
    if (ScriptHistory[0] > 5.00 || ScriptHistory[1] > 5.00 || ScriptHistory[2] > 5.00) {
        CurrentMultiplier = Math.floor(Math.random() * 299) + 233;
        CurrentMultiplier = CurrentMultiplier / 100;
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] 5x in last 3 rounds');
    }
    if (LastResult == "Won") {
        CurrentMultiplier = Math.floor(Math.random() * 311) + 215;
        CurrentMultiplier = CurrentMultiplier / 100;
        GetNumber = CurrentMultiplier;
        CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
    }

}
function minitrains() {
    if (Green > 3 && LastResult == "Lost") {
        CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
        CurrentMultiplier = 2.14;
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Green x3 & Loss');
    }
    if (Green > 3 && LastResult == "Won") {
        CurrentBet = BaseBet;
        CurrentMultiplier = 3.11;
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Green x3 & Won');
    }
    if (Red > 3 || Green > 3) {
        CurrentMultiplier = Math.floor(Math.random() * 311) + 199;
        CurrentMultiplier = CurrentMultiplier / 100;
        CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Red/Green x3');
    }
}
function threeafterthree () {
    if (ScriptHistory[0] > 2.99 && ScriptHistory[1] > 2.99 && ScriptHistory[2] > 2.99) {
        if ((CurrentGameID - LastTrain) > 15 && (CurrentGameID - LastShrek > 10)) {
            if (LastResult == "Won") {
                CurrentBet = BaseBet * 2;
                CurrentMultiplier = 2.14;
                GetNumber = CurrentMultiplier;
                console.log('[Bet Adjustment] 3x after 3 rounds & Won');
            }
            if (LastResult == "Lost") {
                CurrentMultiplier = Math.floor(Math.random() * 288) + 211;
                CurrentMultiplier = CurrentMultiplier / 100;
                CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
                GetNumber = CurrentMultiplier;
                console.log('[Bet Adjustment] 3x after 3 rounds & Lost');
            }
        }
    }
    
}
function findconfidence() {
    PayOutConfidence = [];
    for (i = 0; i < PayOutPercents.length; i++) {
        if (PayOutPercents < 100) {
            PayOutConfidence = (100 - PayOutPercents);
            PayOutConfidence = Math.abs(PayOutConfidence);
            PayOutConfidence = (PayOutConfidence + 25);
        }else if (PayOutPercents == 100) {
            PayOutConfidence = 25;
        }else{
            PayOutConfidence = 0;
        }
        if (i > 3) {
            PayOutConfidence = (PayOutConfidence - 25);
        }
        if (i > 5) {
            PayOutConfidence = (PayOutConfidence - 25);
        }
        if (PayOutConfidence < 0) {
            PayOutConfidence = 0;
        }
    }
}
function findlargestindex() {
    IndexMax = PayOutConfidence[0];
    MaxIndex = 0;
    for (var i = 1; i < PayOutConfidence.length; i++) {
        if (PayOutConfidence >= IndexMax) {
            MaxIndex = i;
            IndexMax = PayOutConfidence;
        }
    }
}

function checkbet() {
    MinimumBet = currency.minAmount;
    BaseBet = config.bet.value;
//Check bet against player bankroll --- For what parameters???
//Check bet against site bankroll  - is there enough to win all we want?
    if (CurrentBet < BaseBet) {
        CurrentBet = BaseBet;
    }
    if (CurrentBet < MinimumBet) {
        CurrentBet = MinimumBet;
    }      
    if (CurrentBet > MaxBet) {
        CurrentBet = MaxBet;
        console.log('[Bet Adjustment] Survive Losses');
    }
    if (CurrentBet > currency.maxAmount) {
        CurrentBet = currency.maxAmount;
        MaxBet = currency.maxAmount / 5;
        console.log('[Bet Adjustment] Maximum Bet allowed by platform');
    }
    if (CurrentBet > LargestBet[0]) {
        LargestBet[0] = CurrentBet;
        LargestBet[1] = CurrentMultiplier;
    }
}
engine.on('GAME_ENDED', function (data) {
    console.log(data);
    RoundsViewed++;
    LastCrash = data.crash;
    PrevCashOut = LastCrash;
    LastGameID = data.gameId;
    if (GameInfoLogged == "False") {
        loglastcrash(data);
    }
    updateplayer();
    updatestats();
    CurrentGameID = CurrentGameID.toString();
    if (CurrentGameID.endsWith('0')) {
        console.log(version);
        console.log('%c~~Nov~~~~ Update Completed ~~~~2019~~','color:blue;font-weight:bold');
        log.info('~~Nov~~~~ Update Completed ~~~~2019~~');
        log.info(version);
    }
    if (UpdateBets == "True" && LastResult == "Won") {
        betupdate();
        UpdateBets = "False";
    }
    BetYet = "False";
    StrategyFound = "False";
    LoggedBetData = "False";
    Paused = "False";
});
function loglastcrash(data) {
    if (PrevCashOut > LargestMulitplier) {
        LargestMulitplier = PrevCashOut;
    }
    if (PrevCashOut < 2.01) {
        Red++;
        Green = 0;
        if (Red == 6) {
            if (LastTrain === 0) {
                Trains = [];
            }
            Trains.unshift(CurrentGameID);
            Gap = CurrentGameID - LastTrain;
            AverageGap = (AverageGap + Gap) / Trains.length;
            console.log('Logging Round ' + CurrentGameID + ' as H Train');
            console.log('Average Gap ' + AverageGap + ' between H Trains');
            log.info('Logging Round ' + CurrentGameID + ' as H Train');
            console.log('Gap from last H Train ' + Gap + ' rounds');
            log.info('Gap from last H Train ' + Gap + ' rounds');
            LastTrain = CurrentGameID;
        }
    }else{
        Green++;
        Red = 0;
        if (Green == 6) {
            LastShrek = CurrentGameID;
            console.log('Logging Round ' + CurrentGameID + ' as Shrek');
            log.info('Logging Round ' + CurrentGameID + ' as Shrek');
        }
    }
    if (CoinLost > MostLost) {
        MostLost = CoinLost;
    }
    if (ScriptHistory.unshift(PrevCashOut) > 999) ScriptHistory.pop();
//Check for if round was played
    if (data.wager > 0) {
        TotalBets = TotalBets + CurrentBet;
        data.wager = CurrentBet;
        IsPlaying = "True";
        winorlose(data);
        RoundsPlayed++;
        LastBet = CurrentBet;
        LastMultiplier = CurrentMultiplier;
    }else{
        LastResult = "Not Played";
    }
}
function winorlose (data) {
    if (data.cashedAt) {
        WonAmount = ((CurrentBet * CurrentMultiplier) - CoinLost - CurrentBet);
        Profit = Profit + WonAmount;
        LastResult = "Won";
        Wins++;
        Losses = 0;
        if (Profit > ATHProfit) {
            ATHProfit = Profit;
            CoinLost = 0;
        }else{
            CoinLost = ATHProfit - Profit;
        }
        log.info("[Profit] " + WonAmount);
        console.log('%c[Result] Round Won. ' + 'Net Profit of ' + WonAmount.toFixed(7),'color:green');
    }else{
        LastResult = "Lost";
        Losses++;
        Wins = 0;
        CoinLost = CoinLost + CurrentBet;
        console.log('%c[Result] Round ' + LastResult,'color:red');
        log.info('Round Lost');
    }
    if (Losses > MaxLossesEncountered) {
        MaxLossesEncountered = Losses;
        console.log("Encountered Streak of " + Losses + " Losses Before Win");
        log.info("Encountered Streak of " + Losses + " Losses Before Win");
    }
    if (Losses > 3) {
        console.log('%c[Coin Lost] Cumulative Since Last Win: ' + CoinLost.toFixed(7),'color:red');
        log.info('%c[Coin Lost] Cumulative Since Last Win: ' + CoinLost.toFixed(7));
    }
}
function updatestats() {
    //Lists PayOuts under 10x for last 50 rounds
    for (i = 0; i < MultiplierArray.length; i++) {
        FindThisMultiplier = MultiplierArray;
        FindMultiplierHistory();
        PayOutPercents = ThisAverage;
    }
    //Lists PayOuts 10x and over for last 100 rounds
    if (RoundsViewed > 100) {
        HistorySlice = 100;
        CurrentGameID = CurrentGameID.toString();
        if (CurrentGameID.endsWith('0')) {
            console.log("In the last " + HistorySlice + " rounds there was: ");
        }
        for (i = 0; i < LMultiplierArray.length; i++) {
            FindThisMultiplier = LMultiplierArray;
            FindMultiplierHistory();
        }
    }
//    console.log(PayOutPercents);
}
function FindMultiplierHistory() {
    FindThisMultiplier = (FindThisMultiplier - 0.01);
    Array2Filter = ScriptHistory.slice(0,[HistorySlice]);
    FilteredArray = Array2Filter.filter(function (e) {
        return e > FindThisMultiplier;
        });
    FindThisMultiplier = (FindThisMultiplier + 0.01);
    DisplayTimesSeen();
    findpercents();
}
function DisplayTimesSeen() {
    FindShouldHave = (Array2Filter.length / FindThisMultiplier);
    FindShouldHave = (FindShouldHave * 100);
    FindShouldHave = Math.round(FindShouldHave);
    FindShouldHave = (FindShouldHave / 100);
    CurrentGameID = CurrentGameID.toString();
    if (CurrentGameID.endsWith('0')) {
        console.log("PayOuts " + FindThisMultiplier + "x & Higher " + Math.round(FindShouldHave) + " times. There were " + FilteredArray.length);
    }
}
function findpercents() {
    ThisAverage = FilteredArray.length / Math.round(FindShouldHave);
    ThisAverage = (ThisAverage * 100);
    ThisAverage = Math.round(ThisAverage);
}
function updateplayer() {
    EndBalance = currency.amount;
    NetProfit = EndBalance - StartBalance;
    var ProfitPercent = (NetProfit / StartBalance) * 100;
    EndTime = new Date();
    TimeDiff = ((EndTime - StartTime) / 1000 )/ 60;
    ProfPerMin = (Profit / TimeDiff);
    CurrentGameID = CurrentGameID.toString();
    if (CurrentGameID.endsWith('0')) {
        console.log(" ");
        log.info(" ");
        console.log('%c~~~~~~~~~~ NubsScript Update ~~~~~~~~~~','color:blue;font-weight:bold');
        log.info('~~~~~  NubsScript Update  ~~~~~');
        figuretime();
        console.log("Begining Bank " + StartBalance.toFixed(7) + " Current Bank " + currency.amount.toFixed(7) + " " + currency.currencyName);
        log.info("Begining Bank " + StartBalance.toFixed(7) + " Current Bank " + currency.amount.toFixed(7) + " " + currency.currencyName);
        console.log("Current Base Bet: " + config.auto.value + " "+ BaseBet  + " " + currency.currencyName);
        log.info("Current Base Bet: " + BaseBet + " " + currency.currencyName);
        console.log("Session Net Profit " + NetProfit.toFixed(7) + ' ' + currency.currencyName + " or " + ProfitPercent.toFixed(2) + "% ");
        log.info("Session Net Profit " + NetProfit.toFixed(7) + ' ' + currency.currencyName + " or " + ProfitPercent.toFixed(2) + "% ");
        console.log("Profit Per Minute " + ProfPerMin.toFixed(7) + ' ' + currency.currencyName);
        log.info("Profit Per Minute " + ProfPerMin.toFixed(7) + ' ' + currency.currencyName);
        console.log("Highest PayOut Seen: " + LargestMulitplier + "x");
        log.info("Highest PayOut Seen: " + LargestMulitplier + "x");
        console.log("Cumulative Amount Bet: " + TotalBets.toFixed(7) + " " + currency.currencyName);
        log.info("Cumulative Amount Bet: " + TotalBets.toFixed(7) + " " + currency.currencyName);
        console.log("Biggest Bet Placed " + LargestBet[0] + " at " + LargestBet[1] + "x");
        log.info("Biggest Bet Placed " + LargestBet[0] + " at " + LargestBet[1] + "x");
        console.log("Largest Loss: " + MostLost.toFixed(7) + " " + currency.currencyName + " on " + MaxLossesEncountered + " consecutive losses");
        log.info("Largest Loss: " + MostLost.toFixed(7) + " " + currency.currencyName + " on " + MaxLossesEncountered + " consecutive losses");
        if (Trains.length > 2) {
            console.log("Hilarious Train IDs:");
            console.log(Trains);
        }
        console.log("In the last " + HistorySlice + " rounds there was: ");
    }
    RoundsViewed = RoundsViewed.toString();
    if (RoundsViewed.endsWith('00') && config.auto.value == "Script") {
        UpdateBets = "True";
    }
}
function figuretime() {
// get total seconds between the times
var delta = Math.abs(StartTime - EndTime) / 1000;
// calculate (and subtract) whole days
var days = Math.floor(delta / 86400);
delta -= days * 86400;
// calculate (and subtract) whole hours
var hours = Math.floor(delta / 3600) % 24;
delta -= hours * 3600;
// calculate (and subtract) whole minutes
var minutes = Math.floor(delta / 60) % 60;
delta -= minutes * 60;
// what's left is seconds
var seconds = delta % 60;  // in theory the modulus is not required
if (days > 0) {
    console.log("Viewed " + RoundsViewed + " Rounds in " + days + " days " + hours + " hours " + minutes + " minutes");
    log.info("Viewed " + RoundsViewed + " Rounds in " + days + " days " + hours + " hours " + minutes + " minutes");
}else if (hours > 0) {
    console.log("Viewed " + RoundsViewed + " Rounds in " + hours + " hours " + minutes + " minutes");
    log.info("Viewed " + RoundsViewed + " Rounds in " + hours + " hours " + minutes + " minutes");
}else{
    console.log("Viewed " + RoundsViewed + " Rounds in " + minutes + " minutes");
    log.info("Viewed " + RoundsViewed + " Rounds in " + minutes + " minutes");
}
}
function checkstoppers() {
    if (TimeDiff > config.end.value && LastResult == "Won") {
        log.info("Stopped Due to User Parameters (Minutes)");
        console.log("Stopped Due to User Parameters (Minutes)");
        engine.stop();
    }
    if (Profit > config.profit.value && LastResult == "Won") {
        log.info("Stopped Due to User Parameters (Profit)");
        console.log("Stopped Due to User Parameters (Profit)");
        engine.stop();
    }
    if (CoinLost > StopLossCoin) {
        log.info("Stopping Due to User Parameters");
        console.log("Stopping Due to User Parameters (Coin Lost)");
        engine.stop();
    }
}
function betupdate() {
    BaseBet = currency.amount / 15000;
    if (BaseBet < currency.minAmount) {
        BaseBet = currency.minAmount;
        console.log("Bankroll too small. Attempting script by user's command");
    }
    config.bet.value = BaseBet;
    MaxBet = (currency.amount / 10);
    config.stop.value = currency.amount * 0.98;
    console.log('%c[WARNING]: Stop Loss Updated to ' + config.stop.value, 'color:Orange; font-weight:bold');
    console.log('%c[WARNING]: Base Bet Updated to ' + BaseBet, 'color:Orange; font-weight:bold');
}
}

Ist this the last version of this script?

Link to comment
Share on other sites

Just so you know if you want the longer history of the game results, if you inject javascript into the main page you can get that no problem, it will only give you the last 2000 games though.  You can also get what everyone else is betting that way if you want to write a script that owuld place bets following a particular user.  In this same way it would not be hard to rewrite the scripts to play all from the front end like that as they do expose a way to place bests from here as well.  Useing the scripting framework i imagine had two different goals in mind. First to make it easier for people who don't know how to auomate web tech in general. And second to be able to control how long and what kind of scripts are ran.  I stopped sharing mine widely after realizing that they first will change the beahvior of the games after about 24-48 hours to start matching and defeating your specific strategy, etc...  I saw people asking for this script to skip games or do safety rolls.  The most successful scripts i have found is the first one i grab configurable random numbers in a range for (number of losses before i skip games because of a loosing streak (generally 2 or 3 games though). how many winning game to see before i bet again (i had to make this more than 1 like i originally had it because i would see after about 24 hours all of a sudden there were very long streaks of LLWLLWLLW just enough losses to get me to sit out on a game that was a win which would trigger me to start betting again.   the other script that has actually done nicely for me is just betting a single game with a large bit and low payout like 25% of my bank roll at 1.1x, and doing so an random intervals, like 1 game then skip 0-10 games depending on the random roll.  This last approach was the closest i would really get to ensure there was no real pattern for the system to grab and start using against me.

if you want crash history you can use this command in the dev console window  you can use crash.history.  History in this case is a 2000 element array. If you want information on other players and their betting you can get that here crash.playersDict which is a dictionary keyed on playerid with their betting status for the upcoming game.

 

The game or engine object that you have access to in the normal scripts, is just a subset of what is in the crash object in this case, or lbg for limbo, or hdg for hashdice.

 

Link to comment
Share on other sites

On 2/24/2022 at 2:22 PM, Skele said:



if you want crash history you can use this command in the dev console window  you can use crash.history.  History in this case is a 2000 element array.

 

So there actually is a way to take Nubz' Smart Script and make it start with a history of 2000 instead of 10 or 20??  If so, do you think you could help me with that??
 

BTW.. 

I've gotten Nubz Script working and functioning properly if anybody is interested.  It no longer keeps growing uncontrollably. Now it returns to basebet once your running-balance reaches the previous all-time-high, and the basebet updates every 100 rounds.

Link to comment
Share on other sites

Thanks Skele,

Yes, Cryptorichi that was the last version of the script I did. I now play manually with Hash Dice or Limbo.
That script is based upon the losses you have incurred so far. It doesn't anticipate anything. Therefore, there will come a time when the gap between wins will be too great to overcome.

By grabbing the last 2k rounds, I should be able to incorporate the Deep Learning api into it. Although it wouldn't be perfect it would return better results than the v2.3. We used to do it with Hash Dice until the game engine changed. Crash is really slow, I used to only play Crash, but now I rarely do. 14k rounds in a day for Crash compared to 100k rolls for Limbo/Hash Dice.

 

Link to comment
Share on other sites

On 4.3.2022 at 03:54, NubsScripts said:

Danke Skele,

ja, Cryptorichi, das war die letzte Version des Skripts, das ich gemacht habe. Ich spiele jetzt manuell mit Hash Dice oder Limbo.
Dieses Skript basiert auf den Verlusten, die Sie bisher erlitten haben. Es nimmt nichts vorweg. Daher wird es eine Zeit geben, in der die Lücke zwischen den Siegen zu groß sein wird, um sie zu überwinden.

Indem ich mir die letzten 2.000 Runden schnappe, sollte ich in der Lage sein, die Deep-Learning-API darin zu integrieren. Obwohl es nicht perfekt wäre, würde es bessere Ergebnisse liefern als v2.3. Früher haben wir es mit Hash Dice gemacht, bis sich die Spiel-Engine geändert hat. Crash ist wirklich langsam, ich habe früher nur Crash gespielt, aber jetzt tue ich es selten. 14.000 Runden an einem Tag für Crash im Vergleich zu 100.000 Würfen für Limbo/Hash Dice.

 

I modified your script a bit, with long red phases it pauses and other modifications. I have to say it has been stable for 4 weeks. the script generates a stable 4% return per day. I have to say your script is the best I've ever seen

Link to comment
Share on other sites

  • 4 weeks later...
On 12/8/2021 at 8:19 PM, Skele said:

kind of lack luster.  I have several scripts but one of main things i did was add better logging image.png.f86dda1f2d8720599e6fee5c49f4b07a.png

I also added a feature that after two losses in a row, it will pause until it sees at least 1 win.  You sometimes miss a win on the 3rd game true.  But i no longer have to deal with 13 game losing streaks.  It will take two and then just wait it out for green pastures.  I need to change my script back to straight amounts for better, currently i use a percentage of my bank roll for the bet and then this one is the typical double it on loss. I will post it in its own message

var config = {
    betPercentage: {
        label: 'percentage of total coins to bet',
        value: 0.25,
        type: 'number'
    },
    payout: {
        label: 'payout',
        value: 2,
        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: 1,
        type: 'number'
    },
    otherConditionsTitle: {
        label: 'Other Stopping Conditions',
        type: 'title'
    },    
    winGoalAmount: {
        label: 'Stop once you have made this much',
        value: currency.amount * 2,
        type: 'number'
    },
    lossStopAmount: {
        label: 'Stop betting after losing this much without a win.',
        value: 0,
        type: 'number'
    },    
    otherConditionsTitle: {
        label: 'Experimentle Please Ignore',
        type: 'title'
    },
    loggingLevel: {
        label: 'logging level',
        value: 'compact',
        type: 'radio',
        options: [{
                value: 'info',
                label: 'info'
            }, {
                value: 'compact',
                label: 'compact'
            }, {
                value: 'verbose',
                label: 'verbose'
            }
        ]
    }
};
// deleted input parameters
var stop = 0;
var lossesForBreak = 0;
var roundsToBreakFor = 0;

// end deleted parameters
var totalWagers = 0;
var netProfit = 0;
var totalWins = 0;
var totalLoses = 0;
var longestWinStreak = 0;
var longestLoseStreak = 0;
var currentStreak = 0;
var loseStreak = 0;
var numberOfRoundsToSkip = 0;
var currentBet = GetNewBaseBet();
var totalNumberOfGames = 0;
var originalbalance = currency.amount;
var runningbalance = currency.amount;
var consequetiveLostBets = 0;
var lossStopAmountVar = config.lossStopAmount.value;

function main() {

    game.onBet = function () {

        // if we are set to skip rounds then do so.
        if (numberOfRoundsToSkip > 0) {
            numberOfRoundsToSkip -= 1;
            log.info('Skipping round to relax, and the next ' + numberOfRoundsToSkip + ' rounds.');
            return;
        } else {
        
                if(totalNumberOfGames == 0)
                {
                    // this is so we account for the first round.
                    currentBet = GetNewBaseBet();
                }
                
                if(loseStreak >= 2)
                {
                    if(game.history[0].crash > 200)
                    {
                        loseStreak = 0;
                    }
                    else
                    {
                        log.info('Not betting until current loseStreak is over.');
                        return;
                    }                    
                }

            log.info('Placed bet for the amount of ' + currentBet);
            game.bet(currentBet, config.payout.value).then(function (payout) {
                runningbalance -= currentBet;
                totalWagers += currentBet;
                totalNumberOfGames += 1;

                if (payout > 1) {
                    var netwin = currentBet * config.payout.value - currentBet;
                    consequetiveLostBets = 0;
                    if(config.loggingLevel.value != 'compact')
                    {
                        LogMessage('We won a net profit of: ' + netwin.toFixed(8), 'success');
                    }
                    netProfit += netwin;
                    runningbalance += netwin + currentBet;

                    if (loseStreak > 0) {
                        loseStreak = 0;
                    }

                    currentStreak += 1;
                    totalWins += 1;

                    LogSummary('true', currentBet);

                    if (config.onWin.value === 'reset') {
                        currentBet = GetNewBaseBet();
                    } else {
                        currentBet *= config.winMultiplier.value;
                    }

                    LogMessage('We won, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'success');
                } else {
                        log.error('We lost a net amount of: ' + currentBet.toFixed(8));
                        netProfit -= currentBet;
                        loseStreak += 1;
                        currentStreak = 0;
                        totalLoses += 1;
                        consequetiveLostBets += currentBet;

                        LogSummary('false', currentBet);

                        if (config.onLoss.value == 'reset') {
                            currentBet = GetNewBaseBet();
                        } else {
                            currentBet *= config.lossMultiplier.value;
                        }
                            LogMessage('We lost, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'failure');            
                    }

                    if (currentStreak > longestWinStreak) {
                        longestWinStreak = currentStreak;
                    }
                    if (loseStreak > longestLoseStreak) {
                        longestLoseStreak = loseStreak;
                    }

                    recordStats();

                    if (config.winGoalAmount.value != 0 && netProfit > config.winGoalAmount.value) {
                        // we have earned enough stop and quit.
                        log.success('The net profits ' + netProfit.toFixed(8) + ' which triggers stop the for making enough.');
                        game.stop();
                    }
                    if (lossStopAmountVar != 0 && consequetiveLostBets > (lossStopAmountVar)) {
                        // the point of this is to limit the bleed so you don't loose too much.
                        log.error('The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
                        game.stop();
                    }
                }
            );
        }
    };
    }

    function recordStats() {
        if (config.loggingLevel.value != 'compact') {
            LogMessage('total wagers: ' + totalWagers.toFixed(8), 'info');
            LogMessage('Net Profit: ' + netProfit.toFixed(8), 'info');
            LogMessage('Current win streak: ' + currentStreak, 'info');
            LogMessage('Current Lose streak: ' + loseStreak, 'info');
            LogMessage('Total wins: ' + totalWins, 'info');
            LogMessage('Total Losses: ' + totalLoses, 'info');
            LogMessage('Longest win streak: ' + longestWinStreak, 'info');
            LogMessage('Longest lose streak: ' + longestLoseStreak, 'info');
        }
    }

    function GetNewBaseBet() {
        var returnValue = 0;
        returnValue = runningbalance * (config.betPercentage.value / 100);

        if(returnValue > currency.minAmount)
        {
            LogMessage('Recalculating base bet to ' + returnValue.toFixed(8) + ' which is ' + config.betPercentage.value + ' percent of ' + runningbalance.toFixed(8), 'info');
        }
        else
        {
            LogMessage('The recalculated bet amount ' + returnValue.toFixed(8) + ' is lower than the minimum allowed bet.  Setting bet to the minimum allowable amount of ' + currency.minAmount, 'info');
            returnValue = currency.minAmount;
        }

        return returnValue;
    }

    function LogSummary(wasWinner, betAmount) {
        if (config.loggingLevel.value == 'compact') {
            if (wasWinner == 'true') {
                var winAmount = (betAmount * config.payout.value) - betAmount;
                log.success('Winner!! You won ' + winAmount.toFixed(8));
            } else {
                log.error('Loser!! You lost ' + betAmount.toFixed(8));
            }
            var winPercentage = (totalWins / totalNumberOfGames) * 100;
            var losePercentage = (totalLoses / totalNumberOfGames) * 100;

            log.info('Total Games: ' + totalNumberOfGames);
            log.info('Wins: ' + totalWins + '(' + winPercentage.toFixed(2) + ' % )');
            log.info('Loses: ' + totalLoses + '(' + losePercentage.toFixed(2) + ' % )');

            var netNumber = runningbalance - originalbalance;
            var netPecentage = (netNumber / originalbalance) * 100;

            if (originalbalance < runningbalance) {
                log.success('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            } else {
                log.error('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            }
        }

    }

    /// Determines whether or not to log an event or not to make it easier later
    function LogMessage(message, loggingLevel) {
        if (message) {

            if (config.loggingLevel.value != 'compact') {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'info':
                    log.info(message);
                    break;
                case 'compact':
                    break;
                case 'verbose':
                    if (isVerbose)
                        log.info(message);
                    break;
                }
            } else {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'compact':
                    log.info(message);
                    break;
                case 'info':
                    break;
                case 'verbose':
                    break;
                }
            }
        }
    }

I on average double up every few hours with this, but there are times where it goes into a run away nose dive so i don't leave it unattended without a stop loss amount set.  But that stop loss is calculated from the last win and not from the session so it will stop before it eats all of the profits away.

Loving this script. I do have one question though. When running the script there is an experimental section with an option to stop betting after losing so much without a win. How do I get this to function properly?

Link to comment
Share on other sites

On 1/21/2022 at 9:36 PM, Skele said:

loads fine for me

 

//******************* Nubs27's Smart Script for Crash  *******************
//
//
//
// If you find this script helpful please consider donating to Nubs27 or tipping on NanoGames.io:
// Referral Link: https://n-luzqe.nanogames.io/
//
// Donations accepted in many coin/token types. List & Addresses:
// https://sites.google.com/view/nanogamescrashscripts/home/donation-addresses
//
//
//
var config = {
    mainTitle: { label: '*** Nubs27\'s Smart Script for Crash ***', type: 'title' },
    auto: { label: '', value: 'Script', type: 'radio', options: [
           { value: 'Script', label: 'Script chooses Base Bet'},
           { value: 'Player', label: 'Player chooses Base Bet'} ]},
    bet: { label: 'Base Bet', value: currency.minAmount, type: 'number' },
    lossTitle: { label: 'Stop When ', type: 'title' },
    stop: { label: 'Coins Lost >', value: 1, type: 'number' },
    end: { label: 'Minutes >', value: 250, type: 'number' },
    profit: { label: 'Profit >', value: 100, type: 'number' },
};

function main () {
//PayOuts checked in the Stats Update
const MultiplierArray = [2.5, 3.00, 5.00, 6.00, 7.00];
const LMultiplierArray = [10.00, 20.00, 50.00, 100.00];
var version = "v2.3";
var PayOutPercents = [];
var PayOutConfidence = [];
var Array2Filter = [];
var FilteredArray = [];
var ScriptHistory = [];
var Trains = []; // Red Train IDs - finding gaps between & correlation between gap & duration
var History = [];
var RoundsPlayed = 0;
var RoundsViewed = 0;
var LastGameID = 1;
var CurrentGameID = LastGameID + 1;
var MinimumBet = currency.minAmount;
var MaxBet = (currency.amount / 10);
var TotalBets = 0;
var CurrentMultiplier = MultiplierArray[1];
var LastMultiplier = MultiplierArray[1];
var MaxLossesEncountered = 3;
var MostLost = 0;
var LargestMulitplier = 2;
var BaseBet = config.bet.value;
var CurrentBet = BaseBet;
var LastBet = BaseBet;
var LastShrek = CurrentGameID;
var LastTrain = 0;
var Gap = 0;
var AverageGap = 0;
var LargestBet = [0,0];
var Enable100ID = 1000000;
var LastResult = "Won";
var CoinLost = 0;
var StopLossCoin = config.stop.value;
var Losses = 0;
var Wins = 0;
var Red = 0;
var Green = 0;
var StartTime = new Date();
var EndTime = new Date();
var TimeDiff = (EndTime - StartTime);
var StartBalance = currency.amount;
var EndBalance = 0;
var Profit = 0;
var ATHProfit = 0;
var ProfPerMin = 0;
var NetProfit = 0;
var DisplayGreeting = "False";
var GotHistory = "False";
var BetYet = "False";
var LoggedBetData = "False";
var GameInfoLogged = "False";
var StrategyFound = "False";
var IsPlaying = "False";
var UpdateBets = "False";
var Enable100 = "False";
var LastCrash = 0;
var PrevCashOut = 0;
var WonAmount = 0;
var FindThisMultiplier = 1;
var FindShouldHave = 2;
var ThisAverage = 1;
var HistorySlice = 50;
var Paused = "True";
var IndexMax = PayOutConfidence[0];
var MaxIndex = 0;
var GetNumber = 0;

// Welcome the Player to the Script
console.clear();

    if (DisplayGreeting == "False") {
        log.info('     Nubs27s Smart Script for Crash');
        log.info("      ****************");
        log.info("See Web Console for more Information (Press F12)");
        console.log('%c~~~~~~~~~~~~~~~~~ Nubs27\'s Smart Script for Crash ~~~~~~~~~~~~~~~~~','color:Purple; font-weight:bold');
        console.log('%cScript Start Time: ' + StartTime,'color:Purple; font-weight:200');
        console.log('  %cWelcome ' , 'color:Purple; font-weight:bold');
        console.log('  %cYour Starting Balance is: ' + StartBalance + ' ' + currency.currencyName, 'color:Purple; font-weight:bold');
        if (config.auto.value == 'Player') {
            if (config.stop.value > currency.amount) {
                MaxBet = (currency.amount / 10);
                config.stop.value = currency.amount * 0.98;
                console.log('%c[WARNING]: Stop Loss is above your Bankroll','color:Orange; font-weight:bold');
                console.log('%c[WARNING]: Stop Loss Updated to ' + config.stop.value, 'color:Orange; font-weight:bold');
            }
            if (config.bet.value > (config.stop.value / 15000)) {
                log.info('[WARNING]: Script Recommends a bankroll of at least ' + (BaseBet * 15000) + '' + currency.currencyName + ' for the Base Bet you provided');
                log.info('[WARNING]: Script Recommends a bankroll of at least ' + (BaseBet * 20000) + '' + currency.currencyName + ' for the Base Bet you provided');
                log.info('[WARNING]: Script Recommends a bankroll of at least ' + (BaseBet * 25000) + '' + currency.currencyName + ' for the Base Bet you provided');
            }
            console.log('  %cYou Input: ' + BaseBet + ' ' + currency.currencyName + ' as the Base Bet', 'color:Purple; font-weight:bold');
        }else{
            betupdate();
            console.log('  %cYour Starting Base Bet is: ' + BaseBet + ' ' + currency.currencyName, 'color:Purple; font-weight:bold');
        }
        console.log('  %cYour Stoppers are: Coin Lost > ' + config.stop.value + '; Minutes > ' + config.end.value + '; Profit > ' + config.profit.value, 'color:Purple; font-weight:bold');
        console.log('%c~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~','color:Purple; font-weight:bold');
        if (config.stop.value > currency.amount) {
            MaxBet = (currency.amount / 10);
            config.stop.value = currency.amount * 0.95;
            console.log('%c[WARNING]: Stop Loss Updated to ' + config.stop.value, 'color:Orange; font-weight:bold');
        }
    }
    DisplayGreeting = "True";
    if (GotHistory == "False") {
        getnanohistory();
        GotHistory = "True";
        console.log(ScriptHistory);
        LastShrek = [];
        LastTrain = [];
    }
//
//
//
//Everything above here only runs 1 time
game.onBet = function () {
    console.log(' ----------------------------');
    CurrentGameID = (LastGameID + 1);
    console.log('[Round ID]: ' + CurrentGameID);
    if (StrategyFound == "False") {
        strategy();
    }
//Checks User Parameters for Stopping Script
    checkstoppers();
    CurrentBet = BaseBet;
    MaxIndex = Math.floor(Math.random() * MaxIndex);
    CurrentMultiplier = GetNumber;
    CurrentBet = ((CoinLost + BaseBet) / CurrentMultiplier - 1);
    checkbet();
    if (BetYet == "False") {
        console.log("[Betting] " + CurrentBet.toFixed(7) + " at " + CurrentMultiplier + "x");
        log.info("[Betting] " + CurrentBet.toFixed(7) + " at " + CurrentMultiplier + "x");
        game.bet(CurrentBet, CurrentMultiplier).then(function (payout) {
        
            console.log(payout);
            RoundsViewed++;
            LastCrash = game.history[0].crash;
            PrevCashOut = LastCrash;
            LastGameID = game.history[0].gameId;
            if (GameInfoLogged == "False") {
                loglastcrash(game.history[0]);
            }
            updateplayer();
            updatestats();
            CurrentGameID = CurrentGameID.toString();
            
            if (CurrentGameID.endsWith('0')) {
                console.log(version);
                console.log('%c~~Nov~~~~ Update Completed ~~~~2019~~','color:blue;font-weight:bold');
                log.info('~~Nov~~~~ Update Completed ~~~~2019~~');
                log.info(version);
            }
            if (UpdateBets == "True" && LastResult == "Won") {
                betupdate();
                UpdateBets = "False";
            }
            BetYet = "False";
            StrategyFound = "False";
            LoggedBetData = "False";
            Paused = "False";        
        });
    }
    BetYet = "True";
};


function getnanohistory() {
    History = engine.getHistory();
    for (i = 0; i < History.length; i++) {
        ScriptHistory.push(History.crash / 100);
        RoundsViewed++;
    }
}
function strategy() {
// Is there a Payout with a 80% Confidence or Higher? If not, pause.
    findconfidence();
// Which Payout has highest confidence based upon history & math?
    findlargestindex();
//    console.log('[Index] ' + '(' + MaxIndex + ')' + ' PayOut: ' + MultiplierArray[MaxIndex] + ' [Largest Confidence] ' + PayOutConfidence[MaxIndex]);
//    console.log(' PayOut ' + MultiplierArray[MaxIndex] + '; Confidence Level ' + PayOutConfidence[MaxIndex] + ' %');
    GetNumber = MultiplierArray[MaxIndex];
// Randomize the PayOut
    randompayout();
//    console.log('[Get Number] is: ' + GetNumber);
    checkforstreaks();
    CurrentMultiplier = GetNumber;
    StrategyFound = "True";
// Which Payout has highest confidence based upon streakiness of rounds?
}
function randompayout() {
    if (LastResult == "Lost" && CurrentMultiplier > 1.98) {
        GetNumber = (CurrentMultiplier * 0.95);
    }else if (LastResult =="Lost") {
        GetNumber = (CurrentMultiplier * 1.25);
    }
    GetNumber = GetNumber * 100;
    GetNumber = Math.floor(Math.random() * GetNumber) + 211;
    GetNumber = GetNumber / 100;
    if (isNaN(GetNumber)) {
        GetNumber = Math.floor(Math.random() * 311) + 251;
        GetNumber = GetNumber / 100;
    }
}
function checkforstreaks() {
    threeafterthree();
    minitrains();
    prevpayouts();
    htrains();
    tens();
//    hundred();
    HistorySlice = 50;
}
function tens() {
    FindThisMultiplier = 9.99;
    HistorySlice = 10;
    historyfilter();
    if (FilteredArray.length > 2) {
        CurrentBet = BaseBet;
        CurrentMultiplier = 3.11;
        console.log('[Bet Adjustment] PayOut +10x = ' + FilteredArray.length);
    }
}
function hundred() {
    FindThisMultiplier = 69;
    HistorySlice = 100;
    historyfilter();
    if (Enable100 == "True" && (CurrentGameID - Enable100ID) > 25) {
        Enable100 = "False";
    }
    if (Enable100 == "True" && LastResult == "Won") {
        Enable100 = "False";
    }
    if (FilteredArray.length === 0) {
        if (Enable100 == "True") {
            CurrentMultiplier = 88.00;
            CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
            console.log('Manadory run at 100x');
        }
    }
}
function historyfilter() {
    Array2Filter = ScriptHistory.slice(0,[HistorySlice]);
    FilteredArray = Array2Filter.filter(function (e) {
        return e > FindThisMultiplier;
    });
}
function htrains() {
    if (Red > 5) {
        CurrentMultiplier = Math.floor(Math.random() * 311) + 199;
        CurrentMultiplier = CurrentMultiplier / 100;
        CurrentBet = ((CoinLost + BaseBet) / (CurrentMultiplier - 1));
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Reds > 5');
    }
    if (Red > 9) {
        CurrentMultiplier = Math.floor(Math.random() * 488) + 235;
        CurrentMultiplier = CurrentMultiplier / 100;
        CurrentBet = ((CoinLost + BaseBet) / (CurrentMultiplier - 1));
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Reds > 5');
    }
}
function prevpayouts() {
    if (ScriptHistory[0] > 5.00 || ScriptHistory[1] > 5.00 || ScriptHistory[2] > 5.00) {
        CurrentMultiplier = Math.floor(Math.random() * 299) + 233;
        CurrentMultiplier = CurrentMultiplier / 100;
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] 5x in last 3 rounds');
    }
    if (LastResult == "Won") {
        CurrentMultiplier = Math.floor(Math.random() * 311) + 215;
        CurrentMultiplier = CurrentMultiplier / 100;
        GetNumber = CurrentMultiplier;
        CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
    }

}
function minitrains() {
    if (Green > 3 && LastResult == "Lost") {
        CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
        CurrentMultiplier = 2.14;
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Green x3 & Loss');
    }
    if (Green > 3 && LastResult == "Won") {
        CurrentBet = BaseBet;
        CurrentMultiplier = 3.11;
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Green x3 & Won');
    }
    if (Red > 3 || Green > 3) {
        CurrentMultiplier = Math.floor(Math.random() * 311) + 199;
        CurrentMultiplier = CurrentMultiplier / 100;
        CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
        GetNumber = CurrentMultiplier;
        console.log('[Bet Adjustment] Red/Green x3');
    }
}
function threeafterthree () {
    if (ScriptHistory[0] > 2.99 && ScriptHistory[1] > 2.99 && ScriptHistory[2] > 2.99) {
        if ((CurrentGameID - LastTrain) > 15 && (CurrentGameID - LastShrek > 10)) {
            if (LastResult == "Won") {
                CurrentBet = BaseBet * 2;
                CurrentMultiplier = 2.14;
                GetNumber = CurrentMultiplier;
                console.log('[Bet Adjustment] 3x after 3 rounds & Won');
            }
            if (LastResult == "Lost") {
                CurrentMultiplier = Math.floor(Math.random() * 288) + 211;
                CurrentMultiplier = CurrentMultiplier / 100;
                CurrentBet = ((CoinLost + (BaseBet * Losses)) / (CurrentMultiplier - 1));
                GetNumber = CurrentMultiplier;
                console.log('[Bet Adjustment] 3x after 3 rounds & Lost');
            }
        }
    }
    
}
function findconfidence() {
    PayOutConfidence = [];
    for (i = 0; i < PayOutPercents.length; i++) {
        if (PayOutPercents < 100) {
            PayOutConfidence = (100 - PayOutPercents);
            PayOutConfidence = Math.abs(PayOutConfidence);
            PayOutConfidence = (PayOutConfidence + 25);
        }else if (PayOutPercents == 100) {
            PayOutConfidence = 25;
        }else{
            PayOutConfidence = 0;
        }
        if (i > 3) {
            PayOutConfidence = (PayOutConfidence - 25);
        }
        if (i > 5) {
            PayOutConfidence = (PayOutConfidence - 25);
        }
        if (PayOutConfidence < 0) {
            PayOutConfidence = 0;
        }
    }
}
function findlargestindex() {
    IndexMax = PayOutConfidence[0];
    MaxIndex = 0;
    for (var i = 1; i < PayOutConfidence.length; i++) {
        if (PayOutConfidence >= IndexMax) {
            MaxIndex = i;
            IndexMax = PayOutConfidence;
        }
    }
}

function checkbet() {
    MinimumBet = currency.minAmount;
    BaseBet = config.bet.value;
//Check bet against player bankroll --- For what parameters???
//Check bet against site bankroll  - is there enough to win all we want?
    if (CurrentBet < BaseBet) {
        CurrentBet = BaseBet;
    }
    if (CurrentBet < MinimumBet) {
        CurrentBet = MinimumBet;
    }      
    if (CurrentBet > MaxBet) {
        CurrentBet = MaxBet;
        console.log('[Bet Adjustment] Survive Losses');
    }
    if (CurrentBet > currency.maxAmount) {
        CurrentBet = currency.maxAmount;
        MaxBet = currency.maxAmount / 5;
        console.log('[Bet Adjustment] Maximum Bet allowed by platform');
    }
    if (CurrentBet > LargestBet[0]) {
        LargestBet[0] = CurrentBet;
        LargestBet[1] = CurrentMultiplier;
    }
}

function loglastcrash(data) {
    if (PrevCashOut > LargestMulitplier) {
        LargestMulitplier = PrevCashOut;
    }
    if (PrevCashOut < 2.01) {
        Red++;
        Green = 0;
        if (Red == 6) {
            if (LastTrain === 0) {
                Trains = [];
            }
            Trains.unshift(CurrentGameID);
            Gap = CurrentGameID - LastTrain;
            AverageGap = (AverageGap + Gap) / Trains.length;
            console.log('Logging Round ' + CurrentGameID + ' as H Train');
            console.log('Average Gap ' + AverageGap + ' between H Trains');
            log.info('Logging Round ' + CurrentGameID + ' as H Train');
            console.log('Gap from last H Train ' + Gap + ' rounds');
            log.info('Gap from last H Train ' + Gap + ' rounds');
            LastTrain = CurrentGameID;
        }
    }else{
        Green++;
        Red = 0;
        if (Green == 6) {
            LastShrek = CurrentGameID;
            console.log('Logging Round ' + CurrentGameID + ' as Shrek');
            log.info('Logging Round ' + CurrentGameID + ' as Shrek');
        }
    }
    if (CoinLost > MostLost) {
        MostLost = CoinLost;
    }
    if (ScriptHistory.unshift(PrevCashOut) > 999) ScriptHistory.pop();
//Check for if round was played
    if (data.wager > 0) {
        TotalBets = TotalBets + CurrentBet;
        data.wager = CurrentBet;
        IsPlaying = "True";
        winorlose(data);
        RoundsPlayed++;
        LastBet = CurrentBet;
        LastMultiplier = CurrentMultiplier;
    }else{
        LastResult = "Not Played";
    }
}
function winorlose (data) {
    if (data.cashedAt) {
        WonAmount = ((CurrentBet * CurrentMultiplier) - CoinLost - CurrentBet);
        Profit = Profit + WonAmount;
        LastResult = "Won";
        Wins++;
        Losses = 0;
        if (Profit > ATHProfit) {
            ATHProfit = Profit;
            CoinLost = 0;
        }else{
            CoinLost = ATHProfit - Profit;
        }
        log.info("[Profit] " + WonAmount);
        console.log('%c[Result] Round Won. ' + 'Net Profit of ' + WonAmount.toFixed(7),'color:green');
    }else{
        LastResult = "Lost";
        Losses++;
        Wins = 0;
        CoinLost = CoinLost + CurrentBet;
        console.log('%c[Result] Round ' + LastResult,'color:red');
        log.info('Round Lost');
    }
    if (Losses > MaxLossesEncountered) {
        MaxLossesEncountered = Losses;
        console.log("Encountered Streak of " + Losses + " Losses Before Win");
        log.info("Encountered Streak of " + Losses + " Losses Before Win");
    }
    if (Losses > 3) {
        console.log('%c[Coin Lost] Cumulative Since Last Win: ' + CoinLost.toFixed(7),'color:red');
        log.info('%c[Coin Lost] Cumulative Since Last Win: ' + CoinLost.toFixed(7));
    }
}
function updatestats() {
    //Lists PayOuts under 10x for last 50 rounds
    for (i = 0; i < MultiplierArray.length; i++) {
        FindThisMultiplier = MultiplierArray;
        FindMultiplierHistory();
        PayOutPercents = ThisAverage;
    }
    //Lists PayOuts 10x and over for last 100 rounds
    if (RoundsViewed > 100) {
        HistorySlice = 100;
        CurrentGameID = CurrentGameID.toString();
        if (CurrentGameID.endsWith('0')) {
            console.log("In the last " + HistorySlice + " rounds there was: ");
        }
        for (i = 0; i < LMultiplierArray.length; i++) {
            FindThisMultiplier = LMultiplierArray;
            FindMultiplierHistory();
        }
    }
//    console.log(PayOutPercents);
}
function FindMultiplierHistory() {
    FindThisMultiplier = (FindThisMultiplier - 0.01);
    Array2Filter = ScriptHistory.slice(0,[HistorySlice]);
    FilteredArray = Array2Filter.filter(function (e) {
        return e > FindThisMultiplier;
        });
    FindThisMultiplier = (FindThisMultiplier + 0.01);
    DisplayTimesSeen();
    findpercents();
}
function DisplayTimesSeen() {
    FindShouldHave = (Array2Filter.length / FindThisMultiplier);
    FindShouldHave = (FindShouldHave * 100);
    FindShouldHave = Math.round(FindShouldHave);
    FindShouldHave = (FindShouldHave / 100);
    CurrentGameID = CurrentGameID.toString();
    if (CurrentGameID.endsWith('0')) {
        console.log("PayOuts " + FindThisMultiplier + "x & Higher " + Math.round(FindShouldHave) + " times. There were " + FilteredArray.length);
    }
}
function findpercents() {
    ThisAverage = FilteredArray.length / Math.round(FindShouldHave);
    ThisAverage = (ThisAverage * 100);
    ThisAverage = Math.round(ThisAverage);
}
function updateplayer() {
    EndBalance = currency.amount;
    NetProfit = EndBalance - StartBalance;
    var ProfitPercent = (NetProfit / StartBalance) * 100;
    EndTime = new Date();
    TimeDiff = ((EndTime - StartTime) / 1000 )/ 60;
    ProfPerMin = (Profit / TimeDiff);
    CurrentGameID = CurrentGameID.toString();
    if (CurrentGameID.endsWith('0')) {
        console.log(" ");
        log.info(" ");
        console.log('%c~~~~~~~~~~ NubsScript Update ~~~~~~~~~~','color:blue;font-weight:bold');
        log.info('~~~~~  NubsScript Update  ~~~~~');
        figuretime();
        console.log("Begining Bank " + StartBalance.toFixed(7) + " Current Bank " + currency.amount.toFixed(7) + " " + currency.currencyName);
        log.info("Begining Bank " + StartBalance.toFixed(7) + " Current Bank " + currency.amount.toFixed(7) + " " + currency.currencyName);
        console.log("Current Base Bet: " + config.auto.value + " "+ BaseBet  + " " + currency.currencyName);
        log.info("Current Base Bet: " + BaseBet + " " + currency.currencyName);
        console.log("Session Net Profit " + NetProfit.toFixed(7) + ' ' + currency.currencyName + " or " + ProfitPercent.toFixed(2) + "% ");
        log.info("Session Net Profit " + NetProfit.toFixed(7) + ' ' + currency.currencyName + " or " + ProfitPercent.toFixed(2) + "% ");
        console.log("Profit Per Minute " + ProfPerMin.toFixed(7) + ' ' + currency.currencyName);
        log.info("Profit Per Minute " + ProfPerMin.toFixed(7) + ' ' + currency.currencyName);
        console.log("Highest PayOut Seen: " + LargestMulitplier + "x");
        log.info("Highest PayOut Seen: " + LargestMulitplier + "x");
        console.log("Cumulative Amount Bet: " + TotalBets.toFixed(7) + " " + currency.currencyName);
        log.info("Cumulative Amount Bet: " + TotalBets.toFixed(7) + " " + currency.currencyName);
        console.log("Biggest Bet Placed " + LargestBet[0] + " at " + LargestBet[1] + "x");
        log.info("Biggest Bet Placed " + LargestBet[0] + " at " + LargestBet[1] + "x");
        console.log("Largest Loss: " + MostLost.toFixed(7) + " " + currency.currencyName + " on " + MaxLossesEncountered + " consecutive losses");
        log.info("Largest Loss: " + MostLost.toFixed(7) + " " + currency.currencyName + " on " + MaxLossesEncountered + " consecutive losses");
        if (Trains.length > 2) {
            console.log("Hilarious Train IDs:");
            console.log(Trains);
        }
        console.log("In the last " + HistorySlice + " rounds there was: ");
    }
    RoundsViewed = RoundsViewed.toString();
    if (RoundsViewed.endsWith('00') && config.auto.value == "Script") {
        UpdateBets = "True";
    }
}
function figuretime() {
// get total seconds between the times
var delta = Math.abs(StartTime - EndTime) / 1000;
// calculate (and subtract) whole days
var days = Math.floor(delta / 86400);
delta -= days * 86400;
// calculate (and subtract) whole hours
var hours = Math.floor(delta / 3600) % 24;
delta -= hours * 3600;
// calculate (and subtract) whole minutes
var minutes = Math.floor(delta / 60) % 60;
delta -= minutes * 60;
// what's left is seconds
var seconds = delta % 60;  // in theory the modulus is not required
if (days > 0) {
    console.log("Viewed " + RoundsViewed + " Rounds in " + days + " days " + hours + " hours " + minutes + " minutes");
    log.info("Viewed " + RoundsViewed + " Rounds in " + days + " days " + hours + " hours " + minutes + " minutes");
}else if (hours > 0) {
    console.log("Viewed " + RoundsViewed + " Rounds in " + hours + " hours " + minutes + " minutes");
    log.info("Viewed " + RoundsViewed + " Rounds in " + hours + " hours " + minutes + " minutes");
}else{
    console.log("Viewed " + RoundsViewed + " Rounds in " + minutes + " minutes");
    log.info("Viewed " + RoundsViewed + " Rounds in " + minutes + " minutes");
}
}
function checkstoppers() {
    if (TimeDiff > config.end.value && LastResult == "Won") {
        log.info("Stopped Due to User Parameters (Minutes)");
        console.log("Stopped Due to User Parameters (Minutes)");
        engine.stop();
    }
    if (Profit > config.profit.value && LastResult == "Won") {
        log.info("Stopped Due to User Parameters (Profit)");
        console.log("Stopped Due to User Parameters (Profit)");
        engine.stop();
    }
    if (CoinLost > StopLossCoin) {
        log.info("Stopping Due to User Parameters");
        console.log("Stopping Due to User Parameters (Coin Lost)");
        engine.stop();
    }
}
function betupdate() {
    BaseBet = currency.amount / 15000;
    if (BaseBet < currency.minAmount) {
        BaseBet = currency.minAmount;
        console.log("Bankroll too small. Attempting script by user's command");
    }
    config.bet.value = BaseBet;
    MaxBet = (currency.amount / 10);
    config.stop.value = currency.amount * 0.98;
    console.log('%c[WARNING]: Stop Loss Updated to ' + config.stop.value, 'color:Orange; font-weight:bold');
    console.log('%c[WARNING]: Base Bet Updated to ' + BaseBet, 'color:Orange; font-weight:bold');
}
}

 

image.png.765634c07fe208cfe5d6e4df9fc15830.png

If it used to work with the last 200 games to determine the pattern and now it's limited to only 10, then it shouldn't be as good as before. However, I know a site which is kind of a crash tool, it can fetch you the last 50k games. Can we integrate that into the script and make it great again? 

Link to comment
Share on other sites

On 3/4/2022 at 4:54 AM, NubsScripts said:

Thanks Skele,

Yes, Cryptorichi that was the last version of the script I did. I now play manually with Hash Dice or Limbo.
That script is based upon the losses you have incurred so far. It doesn't anticipate anything. Therefore, there will come a time when the gap between wins will be too great to overcome.

By grabbing the last 2k rounds, I should be able to incorporate the Deep Learning api into it. Although it wouldn't be perfect it would return better results than the v2.3. We used to do it with Hash Dice until the game engine changed. Crash is really slow, I used to only play Crash, but now I rarely do. 14k rounds in a day for Crash compared to 100k rolls for Limbo/Hash Dice.

 

So what is a good Limbo/Hash Dice script you would recommend?

Link to comment
Share on other sites

  • 3 weeks later...
On 3/12/2022 at 3:00 AM, Cryptochri said:

I modified your script a bit, with long red phases it pauses and other modifications. I have to say it has been stable for 4 weeks. the script generates a stable 4% return per day. I have to say your script is the best I've ever seen

Hey dude, could you post this script?

Link to comment
Share on other sites

On 12/9/2021 at 1:19 PM, Skele said:

kind of lack luster.  I have several scripts but one of main things i did was add better logging image.png.f86dda1f2d8720599e6fee5c49f4b07a.png

I also added a feature that after two losses in a row, it will pause until it sees at least 1 win.  You sometimes miss a win on the 3rd game true.  But i no longer have to deal with 13 game losing streaks.  It will take two and then just wait it out for green pastures.  I need to change my script back to straight amounts for better, currently i use a percentage of my bank roll for the bet and then this one is the typical double it on loss. I will post it in its own message

var config = {
    betPercentage: {
        label: 'percentage of total coins to bet',
        value: 0.25,
        type: 'number'
    },
    payout: {
        label: 'payout',
        value: 2,
        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: 1,
        type: 'number'
    },
    otherConditionsTitle: {
        label: 'Other Stopping Conditions',
        type: 'title'
    },    
    winGoalAmount: {
        label: 'Stop once you have made this much',
        value: currency.amount * 2,
        type: 'number'
    },
    lossStopAmount: {
        label: 'Stop betting after losing this much without a win.',
        value: 0,
        type: 'number'
    },    
    otherConditionsTitle: {
        label: 'Experimentle Please Ignore',
        type: 'title'
    },
    loggingLevel: {
        label: 'logging level',
        value: 'compact',
        type: 'radio',
        options: [{
                value: 'info',
                label: 'info'
            }, {
                value: 'compact',
                label: 'compact'
            }, {
                value: 'verbose',
                label: 'verbose'
            }
        ]
    }
};
// deleted input parameters
var stop = 0;
var lossesForBreak = 0;
var roundsToBreakFor = 0;

// end deleted parameters
var totalWagers = 0;
var netProfit = 0;
var totalWins = 0;
var totalLoses = 0;
var longestWinStreak = 0;
var longestLoseStreak = 0;
var currentStreak = 0;
var loseStreak = 0;
var numberOfRoundsToSkip = 0;
var currentBet = GetNewBaseBet();
var totalNumberOfGames = 0;
var originalbalance = currency.amount;
var runningbalance = currency.amount;
var consequetiveLostBets = 0;
var lossStopAmountVar = config.lossStopAmount.value;

function main() {

    game.onBet = function () {

        // if we are set to skip rounds then do so.
        if (numberOfRoundsToSkip > 0) {
            numberOfRoundsToSkip -= 1;
            log.info('Skipping round to relax, and the next ' + numberOfRoundsToSkip + ' rounds.');
            return;
        } else {
        
                if(totalNumberOfGames == 0)
                {
                    // this is so we account for the first round.
                    currentBet = GetNewBaseBet();
                }
                
                if(loseStreak >= 2)
                {
                    if(game.history[0].crash > 200)
                    {
                        loseStreak = 0;
                    }
                    else
                    {
                        log.info('Not betting until current loseStreak is over.');
                        return;
                    }                    
                }

            log.info('Placed bet for the amount of ' + currentBet);
            game.bet(currentBet, config.payout.value).then(function (payout) {
                runningbalance -= currentBet;
                totalWagers += currentBet;
                totalNumberOfGames += 1;

                if (payout > 1) {
                    var netwin = currentBet * config.payout.value - currentBet;
                    consequetiveLostBets = 0;
                    if(config.loggingLevel.value != 'compact')
                    {
                        LogMessage('We won a net profit of: ' + netwin.toFixed(8), 'success');
                    }
                    netProfit += netwin;
                    runningbalance += netwin + currentBet;

                    if (loseStreak > 0) {
                        loseStreak = 0;
                    }

                    currentStreak += 1;
                    totalWins += 1;

                    LogSummary('true', currentBet);

                    if (config.onWin.value === 'reset') {
                        currentBet = GetNewBaseBet();
                    } else {
                        currentBet *= config.winMultiplier.value;
                    }

                    LogMessage('We won, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'success');
                } else {
                        log.error('We lost a net amount of: ' + currentBet.toFixed(8));
                        netProfit -= currentBet;
                        loseStreak += 1;
                        currentStreak = 0;
                        totalLoses += 1;
                        consequetiveLostBets += currentBet;

                        LogSummary('false', currentBet);

                        if (config.onLoss.value == 'reset') {
                            currentBet = GetNewBaseBet();
                        } else {
                            currentBet *= config.lossMultiplier.value;
                        }
                            LogMessage('We lost, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'failure');            
                    }

                    if (currentStreak > longestWinStreak) {
                        longestWinStreak = currentStreak;
                    }
                    if (loseStreak > longestLoseStreak) {
                        longestLoseStreak = loseStreak;
                    }

                    recordStats();

                    if (config.winGoalAmount.value != 0 && netProfit > config.winGoalAmount.value) {
                        // we have earned enough stop and quit.
                        log.success('The net profits ' + netProfit.toFixed(8) + ' which triggers stop the for making enough.');
                        game.stop();
                    }
                    if (lossStopAmountVar != 0 && consequetiveLostBets > (lossStopAmountVar)) {
                        // the point of this is to limit the bleed so you don't loose too much.
                        log.error('The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
                        game.stop();
                    }
                }
            );
        }
    };
    }

    function recordStats() {
        if (config.loggingLevel.value != 'compact') {
            LogMessage('total wagers: ' + totalWagers.toFixed(8), 'info');
            LogMessage('Net Profit: ' + netProfit.toFixed(8), 'info');
            LogMessage('Current win streak: ' + currentStreak, 'info');
            LogMessage('Current Lose streak: ' + loseStreak, 'info');
            LogMessage('Total wins: ' + totalWins, 'info');
            LogMessage('Total Losses: ' + totalLoses, 'info');
            LogMessage('Longest win streak: ' + longestWinStreak, 'info');
            LogMessage('Longest lose streak: ' + longestLoseStreak, 'info');
        }
    }

    function GetNewBaseBet() {
        var returnValue = 0;
        returnValue = runningbalance * (config.betPercentage.value / 100);

        if(returnValue > currency.minAmount)
        {
            LogMessage('Recalculating base bet to ' + returnValue.toFixed(8) + ' which is ' + config.betPercentage.value + ' percent of ' + runningbalance.toFixed(8), 'info');
        }
        else
        {
            LogMessage('The recalculated bet amount ' + returnValue.toFixed(8) + ' is lower than the minimum allowed bet.  Setting bet to the minimum allowable amount of ' + currency.minAmount, 'info');
            returnValue = currency.minAmount;
        }

        return returnValue;
    }

    function LogSummary(wasWinner, betAmount) {
        if (config.loggingLevel.value == 'compact') {
            if (wasWinner == 'true') {
                var winAmount = (betAmount * config.payout.value) - betAmount;
                log.success('Winner!! You won ' + winAmount.toFixed(8));
            } else {
                log.error('Loser!! You lost ' + betAmount.toFixed(8));
            }
            var winPercentage = (totalWins / totalNumberOfGames) * 100;
            var losePercentage = (totalLoses / totalNumberOfGames) * 100;

            log.info('Total Games: ' + totalNumberOfGames);
            log.info('Wins: ' + totalWins + '(' + winPercentage.toFixed(2) + ' % )');
            log.info('Loses: ' + totalLoses + '(' + losePercentage.toFixed(2) + ' % )');

            var netNumber = runningbalance - originalbalance;
            var netPecentage = (netNumber / originalbalance) * 100;

            if (originalbalance < runningbalance) {
                log.success('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            } else {
                log.error('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            }
        }

    }

    /// Determines whether or not to log an event or not to make it easier later
    function LogMessage(message, loggingLevel) {
        if (message) {

            if (config.loggingLevel.value != 'compact') {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'info':
                    log.info(message);
                    break;
                case 'compact':
                    break;
                case 'verbose':
                    if (isVerbose)
                        log.info(message);
                    break;
                }
            } else {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'compact':
                    log.info(message);
                    break;
                case 'info':
                    break;
                case 'verbose':
                    break;
                }
            }
        }
    }

I on average double up every few hours with this, but there are times where it goes into a run away nose dive so i don't leave it unattended without a stop loss amount set.  But that stop loss is calculated from the last win and not from the session so it will stop before it eats all of the profits away.

Hey dude I tried to get this script to work on hashdice by making it do minimum bets during red trains instead of just waiting out a round but I can't get it to work. How can I get the history for hashdice games instead of crash, or could you possibly get it to work on hashdice? The only part that breaks is 

 

 if(loseStreak >= 2)
                {
                    if(game.history[0].crash > 200)
                    {
                        loseStreak = 0;
                    }
                    else
                    {
                        log.info('Not betting until current loseStreak is over.');
                        return;
                    }                    
                }

 

I've tried changing the if(game.history[0].crash > 200) to a bunch of different variables but nothing I try seems to work. It doesn't help that there's no documentation for scripts on here.

 

Any help would be very much appreciated

Link to comment
Share on other sites

i don't know that hashdice gives you history the same way crash does so it may not be possible through using their scripting sandbox stuff.

but really it shouldn't matter, on crash it had to be done this way because you didn't bet so didn't have the results from the bet.  In hashdice you always have to bet so you should just be checking the result of that bet to see if you won or lost.

Link to comment
Share on other sites

6 hours ago, Skele said:

i don't know that hashdice gives you history the same way crash does so it may not be possible through using their scripting sandbox stuff.

but really it shouldn't matter, on crash it had to be done this way because you didn't bet so didn't have the results from the bet.  In hashdice you always have to bet so you should just be checking the result of that bet to see if you won or lost.

Yeah that's what I thought as well, but I couldn't figure out how to make the script check if I won or not. 

I'm pretty new to coding and was "learning" by reading your code and trying to understand it but couldn't see how you checked for a win or not in the script. 

Link to comment
Share on other sites

Hey guys! I figured out how to make Skele's crash script work on hashdice. It's the exact same as his except now it bets minimum on massive loss streaks and will wait for 3 losses in a row before doing so. (I did some testing and 3 losses in a row seems to be more successful than 2)

 

var config = {
    betPercentage: {
        label: 'percentage of total coins to bet',
        value: 0.25,
        type: 'number'
    },
    payout: {
        label: 'payout',
        value: 2,
        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: 1,
        type: 'number'
    },
    otherConditionsTitle: {
        label: 'Other Stopping Conditions',
        type: 'title'
    },    
    winGoalAmount: {
        label: 'Stop once you have made this much',
        value: currency.amount * 2,
        type: 'number'
    },
    lossStopAmount: {
        label: 'Stop betting after losing this much without a win.',
        value: 0,
        type: 'number'
    },    
    otherConditionsTitle: {
        label: 'Experimentle Please Ignore',
        type: 'title'
    },
    loggingLevel: {
        label: 'logging level',
        value: 'compact',
        type: 'radio',
        options: [{
                value: 'info',
                label: 'info'
            }, {
                value: 'compact',
                label: 'compact'
            }, {
                value: 'verbose',
                label: 'verbose'
            }
        ]
    }
};
// deleted input parameters
var stop = 0;
var lossesForBreak = 0;
var roundsToBreakFor = 0;

// end deleted parameters
var totalWagers = 0;
var netProfit = 0;
var totalWins = 0;
var totalLoses = 0;
var longestWinStreak = 0;
var longestLoseStreak = 0;
var currentStreak = 0;
var loseStreak = 0;
var numberOfRoundsToSkip = 0;
var currentBet = GetNewBaseBet();
var totalNumberOfGames = 0;
var originalbalance = currency.amount;
var runningbalance = currency.amount;
var consequetiveLostBets = 0;
var lossStopAmountVar = config.lossStopAmount.value;

function main() {

    game.onBet = function () {

        // if we are set to skip rounds then do so.
        if (numberOfRoundsToSkip > 0) {
            numberOfRoundsToSkip -= 1;
            log.info('Skipping round to relax, and the next ' + numberOfRoundsToSkip + ' rounds.');
            return;
        } else {
        
                if(totalNumberOfGames == 0)
                {
                    // this is so we account for the first round.
                    currentBet = GetNewBaseBet();
                }
                
                if(loseStreak >= 3)
                {
                    if(game.history[0] >= (config.payout.value * 100))
                    {
                        loseStreak = 0;
                    }
                    else
                    {
                        game.bet(currency.minAmount).then(function (payout) {
                        runningbalance -= currency.minAmount;
                        totalWagers += currency.minAmount;
                        totalNumberOfGames += 1;

                        if (payout > 1) {
                        var netwin = currency.minAmount * config.payout.value - currency.minAmount;
                        consequetiveLostBets = 0;
                        netProfit += netwin;
                        runningbalance += netwin + currency.minAmount;
                        loseStreak = 0;
                        
                        }
                        })
                        log.info('Betting minimum until a win hits');
                        return;
                    }                    
                }

            log.info('Placed bet for the amount of ' + currentBet);
            game.bet(currentBet, config.payout.value).then(function (payout) {
                runningbalance -= currentBet;
                totalWagers += currentBet;
                totalNumberOfGames += 1;

                if (payout > 1) {
                    var netwin = currentBet * config.payout.value - currentBet;
                    consequetiveLostBets = 0;
                    if(config.loggingLevel.value != 'compact')
                    {
                        LogMessage('We won a net profit of: ' + netwin.toFixed(8), 'success');
                    }
                    netProfit += netwin;
                    runningbalance += netwin + currentBet;

                    if (loseStreak > 0) {
                        loseStreak = 0;
                    }

                    currentStreak += 1;
                    totalWins += 1;

                    LogSummary('true', currentBet);

                    if (config.onWin.value === 'reset') {
                        currentBet = GetNewBaseBet();
                    } else {
                        currentBet *= config.winMultiplier.value;
                    }

                    LogMessage('We won, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'success');
                } else {
                        log.error('We lost a net amount of: ' + currentBet.toFixed(8));
                        netProfit -= currentBet;
                        loseStreak += 1;
                        currentStreak = 0;
                        totalLoses += 1;
                        consequetiveLostBets += currentBet;

                        LogSummary('false', currentBet);

                        if (config.onLoss.value == 'reset') {
                            currentBet = GetNewBaseBet();
                        } else {
                            currentBet *= config.lossMultiplier.value;
                        }
                            LogMessage('We lost, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'failure');            
                    }

                    if (currentStreak > longestWinStreak) {
                        longestWinStreak = currentStreak;
                    }
                    if (loseStreak > longestLoseStreak) {
                        longestLoseStreak = loseStreak;
                    }

                    recordStats();

                    if (config.winGoalAmount.value != 0 && netProfit > config.winGoalAmount.value) {
                        // we have earned enough stop and quit.
                        log.success('The net profits ' + netProfit.toFixed(8) + ' which triggers stop the for making enough.');
                        game.stop();
                    }
                    if (lossStopAmountVar != 0 && consequetiveLostBets > (lossStopAmountVar)) {
                        // the point of this is to limit the bleed so you don't loose too much.
                        log.error('The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
                        game.stop();
                    }
                }
            );
        }
    };
    }

    function recordStats() {
        if (config.loggingLevel.value != 'compact') {
            LogMessage('total wagers: ' + totalWagers.toFixed(8), 'info');
            LogMessage('Net Profit: ' + netProfit.toFixed(8), 'info');
            LogMessage('Current win streak: ' + currentStreak, 'info');
            LogMessage('Current Lose streak: ' + loseStreak, 'info');
            LogMessage('Total wins: ' + totalWins, 'info');
            LogMessage('Total Losses: ' + totalLoses, 'info');
            LogMessage('Longest win streak: ' + longestWinStreak, 'info');
            LogMessage('Longest lose streak: ' + longestLoseStreak, 'info');
        }
    }

    function GetNewBaseBet() {
        var returnValue = 0;
        returnValue = runningbalance * (config.betPercentage.value / 100);

        if(returnValue > currency.minAmount)
        {
            LogMessage('Recalculating base bet to ' + returnValue.toFixed(8) + ' which is ' + config.betPercentage.value + ' percent of ' + runningbalance.toFixed(8), 'info');
        }
        else
        {
            LogMessage('The recalculated bet amount ' + returnValue.toFixed(8) + ' is lower than the minimum allowed bet.  Setting bet to the minimum allowable amount of ' + currency.minAmount, 'info');
            returnValue = currency.minAmount;
        }

        return returnValue;
    }

    function LogSummary(wasWinner, betAmount) {
        if (config.loggingLevel.value == 'compact') {
            if (wasWinner == 'true') {
                var winAmount = (betAmount * config.payout.value) - betAmount;
                log.success('Winner!! You won ' + winAmount.toFixed(8));
            } else {
                log.error('Loser!! You lost ' + betAmount.toFixed(8));
            }
            var winPercentage = (totalWins / totalNumberOfGames) * 100;
            var losePercentage = (totalLoses / totalNumberOfGames) * 100;

            log.info('Total Games: ' + totalNumberOfGames);
            log.info('Wins: ' + totalWins + '(' + winPercentage.toFixed(2) + ' % )');
            log.info('Loses: ' + totalLoses + '(' + losePercentage.toFixed(2) + ' % )');

            var netNumber = runningbalance - originalbalance;
            var netPecentage = (netNumber / originalbalance) * 100;

            if (originalbalance < runningbalance) {
                log.success('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            } else {
                log.error('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            }
        }

    }

    /// Determines whether or not to log an event or not to make it easier later
    function LogMessage(message, loggingLevel) {
        if (message) {

            if (config.loggingLevel.value != 'compact') {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'info':
                    log.info(message);
                    break;
                case 'compact':
                    break;
                case 'verbose':
                    if (isVerbose)
                        log.info(message);
                    break;
                }
            } else {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'compact':
                    log.info(message);
                    break;
                case 'info':
                    break;
                case 'verbose':
                    break;
                }
            }
        }
    }

Enjoy! 🙂

Link to comment
Share on other sites

you should make this 3 a parameter, and even better if you make that parameter able to take a range and then you randomly pick from that range. like below, this way

maxLossesBeforeMinBet = GetLossesBeforeMinBet(2-3);



 if(loseStreak >= maxLossesBeforeMinBet)

....

    
    function GetLossesBeforeMinBet()
    {
        if(config.lossesBeforeMinBet.value.toString().indexOf('-') >= 0)
        {
            var numbers = config.lossesBeforeMinBet.value.split('-');
            
            return GetRandomInt(Number.parseInt(numbers[0]), Number.parseInt(numbers[1]));
        }
        else
        {
            return Number.parseInt(config.lossesBeforeMinBet.value);
        }
    }
    
    // Returns a random integer between the min and max.
	function GetRandomInt(min, max)
	{
		var retValue = Math.floor(Math.random() * (max - min)) + min;
		
		log.info('Number of losses before pause is set to ' + retValue + '');
		return retValue;
	}
Edited by Skele
Link to comment
Share on other sites

1 hour ago, Skele said:

you should make this 3 a parameter, and even better if you make that parameter able to take a range and then you randomly pick from that range. like below, this way

maxLossesBeforeMinBet = GetLossesBeforeMinBet(2-3);



 if(loseStreak >= maxLossesBeforeMinBet)

....

    
    function GetLossesBeforeMinBet()
    {
        if(config.lossesBeforeMinBet.value.toString().indexOf('-') >= 0)
        {
            var numbers = config.lossesBeforeMinBet.value.split('-');
            
            return GetRandomInt(Number.parseInt(numbers[0]), Number.parseInt(numbers[1]));
        }
        else
        {
            return Number.parseInt(config.lossesBeforeMinBet.value);
        }
    }
    
    // Returns a random integer between the min and max.
	function GetRandomInt(min, max)
	{
		var retValue = Math.floor(Math.random() * (max - min)) + min;
		
		log.info('Number of losses before pause is set to ' + retValue + '');
		return retValue;
	}

This is a really good idea but I have no idea how I would incorporate that into your script lol I'm really new to all this stuff but I'm definitely gonna try figure it out!!

Link to comment
Share on other sites

i have given you all of the code

Add the two methods anywhere in there out side of the other methods 

replace the ">3" with "> maxLossesBeforeBet"

then add this line
 

maxLossesBeforeMinBet = GetLossesBeforeMinBet();

Everywhere you set your lossStreak back to 0; add the above line right afterwards.

Link to comment
Share on other sites

Interesting. I have an error somewhere and I can't get it to work 100%. I'll look into the matter further, @Skele.

Link to comment
Share on other sites

hey guys! big thanks to @Skelefor the code, so the hashdice script now has a range that you can adjust yourself in the script before it starts betting minimum. i have also taken the time to change the stop-loss variables - there is now an option for it to stop the script or reset the martingale counter instead, and i have made it so that the stop-loss value is based x amount of bets you're able to double rather than a specific number you have to calculate yourself.

please let me know what you think!

 

var config = {
    betPercentage: {
        label: 'Total percentage of bankroll to bet',
        value: 0.0015,
        type: 'number'
    },
    lossesBeforeMinBet: {
        label: 'Losses before minimum bet (range)',
        value: 2-5,
        type: 'text'
    },
    payout: {
        label: 'payout',
        value: 2,
        type: 'number'
    },

    onLoseTitle: {
        label: 'On Loss',
        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: 1,
        type: 'number'
    },
    otherConditionsTitle: {
        label: 'Stop Settings',
        type: 'title'
    },
    playOrStop: {
        label: 'Once loss stop reached, continue betting (Martingale counter reset) or stop betting?',
        value: 'reset',
        type: 'radio',
        options: [{
                value: 'stop',
                label: 'Stop betting'
            }, {
                value: 'continue',
                label: 'Continue betting'
            }
        ]
    },
    winGoalAmount: {
        label: 'Stop once you have made this much',
        value: currency.amount,
        type: 'number'
    },
    lossStopAmount: {
        label: 'Stop betting after losing this many times in a row without a win',
        value: 1,
        type: 'number'
    },
    loggingLevel: {
        label: 'logging level',
        value: 'compact',
        type: 'radio',
        options: [{
                value: 'info',
                label: 'info'
            }, {
                value: 'compact',
                label: 'compact'
            }, {
                value: 'verbose',
                label: 'verbose'
            }
        ]
    }
};
// deleted input parameters
var stop = 0;
var lossesForBreak = 0;
var roundsToBreakFor = 0;

// end deleted parameters
var totalWagers = 0;
var netProfit = 0;
var totalWins = 0;
var totalLoses = 0;
var longestWinStreak = 0;
var longestLoseStreak = 0;
var currentStreak = 0;
var loseStreak = 0;
var numberOfRoundsToSkip = 0;
var currentBet = GetNewBaseBet();
var totalNumberOfGames = 0;
var originalbalance = currency.amount;
var runningbalance = currency.amount;
var consequetiveLostBets = 0;
var lossStopAmountVar = 0;

function main() {

maxLossesBeforeMinBet = GetLossesBeforeMinBet(2-3);

function GetLossesBeforeMinBet()
{
    if(config.lossesBeforeMinBet.value.toString().indexOf('-') >= 0)
    {
        var numbers = config.lossesBeforeMinBet.value.split('-');
        
        return GetRandomInt(Number.parseInt(numbers[0]), Number.parseInt(numbers[1]));
    }
    else
    {
        return Number.parseInt(config.lossesBeforeMinBet.value);
    }
}

// Returns a random integer between the min and max.
function GetRandomInt(min, max)
{
var retValue = Math.floor(Math.random() * (max - min)) + min;

log.info('Number of losses before pause is set to ' + retValue + '');
return retValue;
}

    game.onBet = function () {

        // if we are set to skip rounds then do so.
        if (numberOfRoundsToSkip > 0) {
            numberOfRoundsToSkip -= 1;
            log.info('Skipping round to relax, and the next ' + numberOfRoundsToSkip + ' rounds.');
            return;
        } else {

                if(totalNumberOfGames == 0)
                {
                    // this is so we account for the first round.
                    currentBet = GetNewBaseBet();
                }

                if(loseStreak >= maxLossesBeforeMinBet)
                {
                    if(game.history[0] >= (config.payout.value * 100))
                    {
                        loseStreak = 0;
                        maxLossesBeforeMinBet = GetLossesBeforeMinBet();
                    }
                    else
                    {
                        game.bet(currency.minAmount).then(function (payout) {
                        runningbalance -= currency.minAmount;
                        totalWagers += currency.minAmount;
                        totalNumberOfGames += 1;

                        if (payout > 1) {
                        var netwin = currency.minAmount * config.payout.value - currency.minAmount;
                        consequetiveLostBets = 0;
                        netProfit += netwin;
                        runningbalance += netwin + currency.minAmount;
                        loseStreak = 0;
                        maxLossesBeforeMinBet = GetLossesBeforeMinBet();

                        }
                        })
                        log.info('Betting minimum until a win hits');
                        return;
                    }
                }

            log.info('Placed bet for the amount of ' + currentBet);
            game.bet(currentBet, config.payout.value).then(function (payout) {
                runningbalance -= currentBet;
                totalWagers += currentBet;
                totalNumberOfGames += 1;

                if (payout > 1) {
                    var netwin = currentBet * config.payout.value - currentBet;
                    consequetiveLostBets = 0;
                    if(config.loggingLevel.value != 'compact')
                    {
                        LogMessage('We won a net profit of: ' + netwin.toFixed(8), 'success');
                    }
                    netProfit += netwin;
                    runningbalance += netwin + currentBet;

                    if (loseStreak > 0) {
                        loseStreak = 0;
                        maxLossesBeforeMinBet = GetLossesBeforeMinBet();
                    }

                    currentStreak += 1;
                    totalWins += 1;

                    LogSummary('true', currentBet);

                    if (config.onWin.value === 'reset') {
                        currentBet = GetNewBaseBet();
                    } else {
                        currentBet *= config.winMultiplier.value;
                    }

                    LogMessage('We won, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'success');
                } else {
                        log.error('We lost a net amount of: ' + currentBet.toFixed(8));
                        netProfit -= currentBet;
                        loseStreak += 1;
                        currentStreak = 0;
                        totalLoses += 1;
                        consequetiveLostBets += currentBet;

                        LogSummary('false', currentBet);

                        if (config.onLoss.value == 'reset') {
                            currentBet = GetNewBaseBet();
                        } else {
                            currentBet *= config.lossMultiplier.value;
                        }
                            LogMessage('We lost, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'failure');
                    }

                    if (currentStreak > longestWinStreak) {
                        longestWinStreak = currentStreak;
                    }
                    if (loseStreak > longestLoseStreak) {
                        longestLoseStreak = loseStreak;
                    }

                    recordStats();

                    if (config.winGoalAmount.value != 0 && netProfit > config.winGoalAmount.value) {
                        // we have earned enough stop and quit.
                        log.success('The net profits ' + netProfit.toFixed(8) + ' which triggers stop the for making enough.');
                        game.stop();
                    }
                    if (config.playOrStop.value === 'stop') {
                    if (config.lossStopAmount.value != 0 && config.lossStopAmount.value <= loseStreak && currentBet > currency.minAmount){
                        log.error('The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
                        game.stop();
                        }
                    }
                    if (config.playOrStop.value === 'continue') {
                    if (config.lossStopAmount.value != 0 && config.lossStopAmount.value <= loseStreak && currentBet > currency.minAmount){
                        log.error('The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
                        currentBet = GetNewBaseBet();
                        }   
                    }
                    }
            );
        }
    };
    }

    function recordStats() {
        if (config.loggingLevel.value != 'compact') {
            LogMessage('total wagers: ' + totalWagers.toFixed(8), 'info');
            LogMessage('Net Profit: ' + netProfit.toFixed(8), 'info');
            LogMessage('Current win streak: ' + currentStreak, 'info');
            LogMessage('Current Lose streak: ' + loseStreak, 'info');
            LogMessage('Total wins: ' + totalWins, 'info');
            LogMessage('Total Losses: ' + totalLoses, 'info');
            LogMessage('Longest win streak: ' + longestWinStreak, 'info');
            LogMessage('Longest lose streak: ' + longestLoseStreak, 'info');
        }
    }

    function GetNewBaseBet() {
        var returnValue = 0;
        returnValue = runningbalance * (config.betPercentage.value / 100);

        if(returnValue > currency.minAmount)
        {
            LogMessage('Recalculating base bet to ' + returnValue.toFixed(8) + ' which is ' + config.betPercentage.value + ' percent of ' + runningbalance.toFixed(8), 'info');
        }
        else
        {
            LogMessage('The recalculated bet amount ' + returnValue.toFixed(8) + ' is lower than the minimum allowed bet.  Setting bet to the minimum allowable amount of ' + currency.minAmount, 'info');
            returnValue = currency.minAmount;
        }

        return returnValue;
    }

    function LogSummary(wasWinner, betAmount) {
        if (config.loggingLevel.value == 'compact') {
            if (wasWinner == 'true') {
                var winAmount = (betAmount * config.payout.value) - betAmount;
                log.success('Winner!! You won ' + winAmount.toFixed(8));
            } else {
                log.error('Loser!! You lost ' + betAmount.toFixed(8));
            }
            var winPercentage = (totalWins / totalNumberOfGames) * 100;
            var losePercentage = (totalLoses / totalNumberOfGames) * 100;

            log.info('Total Games: ' + totalNumberOfGames);
            log.info('Wins: ' + totalWins + '(' + winPercentage.toFixed(2) + ' % )');
            log.info('Loses: ' + totalLoses + '(' + losePercentage.toFixed(2) + ' % )');

            var netNumber = runningbalance - originalbalance;
            var netPecentage = (netNumber / originalbalance) * 100;

            if (originalbalance < runningbalance) {
                log.success('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            } else {
                log.error('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            }
        }

    }

    /// Determines whether or not to log an event or not to make it easier later
    function LogMessage(message, loggingLevel) {
        if (message) {

            if (config.loggingLevel.value != 'compact') {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'info':
                    log.info(message);
                    break;
                case 'compact':
                    break;
                case 'verbose':
                    if (isVerbose)
                        log.info(message);
                    break;
                }
            } else {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'compact':
                    log.info(message);
                    break;
                case 'info':
                    break;
                case 'verbose':
                    break;
                }
            }
        }
    }

 

Link to comment
Share on other sites

You need to be a member in order to leave a comment

Sign up for a new account in our community. It's easy!

Register a new account

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...