Jump to content

Crash - var currency.amount


Arsouille

Recommended Posts

Posted

What errors are you seeing?  In any case, I would try:

var Balance = currency.amount;

 log.success('Balance : ' + Balance);

Posted
12 hours ago, Arsouille said:

Hi,

For my crash script, I try to create a var who contain my balance

I try this but I obtain errors

var Balance = currency.amount;

and

console.log('Balance : ' + currency.amount);

Where is my mistakes ?

Thanks

 

Posted

can you post your whole script from start to finish and I will take a look?

Posted

Of course.

This is certainly not the cleanest code, I am an amateur 🙂

Very thanks for your help

 

var config = {
    mainTitle: { label: ' Custom Script Title ', type: 'title' },
    bet: { label: 'Base Bet', value: currency.minAmount, type: 'number' },
};

function main () {

var Nbr_Pause = 0;
var Multiple = 1;
var Base_MiseBet = config.bet.value;

var Balance = currency.amount;

var Cashout = 2;
var Multiplication_MiseBet = 2;
var Division_MiseBet = 2;

var Soustraction_MiseBet = 0;
var MiseBet = Base_MiseBet;
var Nbr_Crash_Pause = 0;

var History = [];
var LastGame = History[0];
var LastCrash = 2;


engine.on('GAME_STARTING', function ()
        {
        if (Nbr_Crash_Pause >= Nbr_Pause)
            {
            engine.bet((Multiple * MiseBet), Cashout);
            }
        }
    );


engine.on('GAME_ENDED', function (data)

    {
// Should be changed to:
    History = engine.getHistory();
    LastGame = History[0];
    LastCrash = (LastGame.crash / 100);
    
    if (LastGame.cashedAt)
        {
    if ((MiseBet - Soustraction_MiseBet) > Base_MiseBet)
         {
             MiseBet = MiseBet - Soustraction_MiseBet;
         Soustraction_MiseBet = MiseBet / Division_MiseBet;
             }    
    else
        {
            MiseBet = Base_MiseBet;
            }
       
        }

    else
        {
        MiseBet = MiseBet * Multiplication_MiseBet;
        Soustraction_MiseBet = MiseBet / Division_MiseBet;
        }

    if (LastCrash < Cashout)
        {
        Nbr_Crash_Pause = Nbr_Crash_Pause + 1;
        }

    else if (LastCrash >= Cashout)
        {
        Nbr_Crash_Pause = 0;
        }

console.log('MiseBet : ' + MiseBet);
console.log('Soustraction_MiseBet : ' + Soustraction_MiseBet);
log.success('Balance : ' + Balance);


    }
    );
}

Posted

Interesting.  When I put your code into Crash it runs.  I removed the semi colon highlighted below as I don't think you need it but it was running either way.

 

var config = {
    mainTitle: { label: ' Custom Script Title ', type: 'title' },
    bet: { label: 'Base Bet', value: currency.minAmount, type: 'number' },
}

function main () {

var Nbr_Pause = 0;
var Multiple = 1;
var Base_MiseBet = config.bet.value;

var Balance = currency.amount;

var Cashout = 2;
var Multiplication_MiseBet = 2;
var Division_MiseBet = 2;

var Soustraction_MiseBet = 0;
var MiseBet = Base_MiseBet;
var Nbr_Crash_Pause = 0;

var History = [];
var LastGame = History[0];
var LastCrash = 2;


engine.on('GAME_STARTING', function ()
        {
        if (Nbr_Crash_Pause >= Nbr_Pause)
            {
            engine.bet((Multiple * MiseBet), Cashout);
            }
        }
    );


engine.on('GAME_ENDED', function (data)

    {
// Should be changed to:
    History = engine.getHistory();
    LastGame = History[0];
    LastCrash = (LastGame.crash / 100);
    
    if (LastGame.cashedAt)
        {
    if ((MiseBet - Soustraction_MiseBet) > Base_MiseBet)
         {
             MiseBet = MiseBet - Soustraction_MiseBet;
         Soustraction_MiseBet = MiseBet / Division_MiseBet;
             }    
    else
        {
            MiseBet = Base_MiseBet;
            }
       
        }

    else
        {
        MiseBet = MiseBet * Multiplication_MiseBet;
        Soustraction_MiseBet = MiseBet / Division_MiseBet;
        }

    if (LastCrash < Cashout)
        {
        Nbr_Crash_Pause = Nbr_Crash_Pause + 1;
        }

    else if (LastCrash >= Cashout)
        {
        Nbr_Crash_Pause = 0;
        }

console.log('MiseBet : ' + MiseBet);
console.log('Soustraction_MiseBet : ' + Soustraction_MiseBet);
log.success('Balance : ' + Balance);


    }
    );
}

Posted

one extra thought for you.

You will notice once you start using it that the balance it displays is always what you started the game with after initially running the script.  you will have to create custome logic to come up with a actively monitored balance.

Posted
1 hour ago, Arsouille said:

Exact

It's the reason why just after GAME_ENDED I receive my new Balance

if (currency.amount > Balance)
    {
    Balance = currency.amount;
    }

 

We can close the Topip. thanks

 

  • 1 month later...
Posted

I don't know what semi colon you were talking about as i don't see one highlighted.  But i do see a closing curly brace highlighted that that one should be closing out the closing out the config variable 

var config = {some dictionary type declaration }

without it the main function becomes a method on the config object. which is clearly not right.

 

var config = {

                             some dictionary stuff

                             function main(){}

                     }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...