Post
Topic
Board Project Development
Re: [Free Script] Untitled Dice - Run your own bitcoin dice site (no server needed)
by
hamburger
on 07/07/2015, 18:56:42 UTC

I don't want to change the Chance, I want to add the target number.

Example for Multiplier x4, the Chance would be 24.75% and the Target would be > 75.24

I would like to show the target before Rolling the dice.

How can I implement this? I'm a bit lost here...

It is very important to explain exactly what you want. Do not expect people who are willing to take time to help you to just know what you are actually want.

If you want to display "Target" instead of "Chance"

Find the following code in app.js

Code:

    return el.div(
      {},
      el.span(
        {className: 'lead', style: { fontWeight: 'bold' }},
        'Chance: '
      ),
      innerNode
    );


Code:

    return el.div(
      {},
      el.span(
        {className: 'lead', style: { fontWeight: 'bold' }},
        'Target: '
      ),
      innerNode
    );


Then change the code to inverse the calculation

Find the following code in app.js

Code:
    // Just show '--' if chance can't be calculated
    var innerNode;
    if (isError) {
      innerNode = el.span(
        {className: 'lead'},
        ' --'
      );
    } else {
      innerNode = el.span(
        {className: 'lead'},
        ' ' + (winProb * 100).toFixed(2).toString() + '%'
      );
    }

change it to

Code:
    // Just show '--' if chance can't be calculated
    var innerNode;
    if (isError) {
      innerNode = el.span(
        {className: 'lead'},
        ' --'
      );
    } else {
      innerNode = el.span(
        {className: 'lead'},
        '  > ' + ((winProb * -100) + 100 ).toFixed(2).toString() + '%'
      );
    }

You site will display;

Target: > 75.24%

as simple as that!

Enjoy.