Jump to content
Arsouille

Crash - var currency.amount

Recommended Posts

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

var Balance = currency.amount;

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

Share this post


Link to post
Share on other sites
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

 

Share this post


Link to post
Share on other sites

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

Edited by kenn3676

Share this post


Link to post
Share on other sites

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);


    }
    );
}

Share this post


Link to post
Share on other sites

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);


    }
    );
}

Share this post


Link to post
Share on other sites

Big Thanks.

Miracles have to happen to believe in them a little longer 🙂

I copied my/our code and past it back, and it also work for me ....

I was able to finish my tought with this : if (((MiseBet - Soustraction_MiseBet) > Base_MiseBet) && (currency.amount < Balance))

Thanks again

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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

 

Share this post


Link to post
Share on other sites

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(){}

                     }

Share this post


Link to post
Share on other sites
On 2/11/2021 at 7:11 PM, 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

This not work

Share this post


Link to post
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

×
×
  • Create New...