Jump to content

I need a little help with Crash Script


Dinscore

Recommended Posts

I have a script that works as intended with the exception on the radio button labels. For some reason only the first two in every section are showing the labels, the last two only the radio buttons. Since it is happening with all of the button groups I believe it is something simple in my code that I am just missing. The labels that are showing up look like they are written correctly. At least they look like the ones that are working.

If anyone can show me how to make the labels show up I'd greatly appreciate it.

// base settings
var config = {
  scriptTitle: {label: '', type: 'title'},
  baseBet: {label: 'Base Bet', value: currency.minAmount, type: 'number'},
  basePayout: {label: 'Base Payout', value: 2.1, type: 'number'},
  stopBet: {label: 'Stop if Bet >', value: 1e8, type: 'number'},
  stopPayout: {label: 'Stop if Payout >', value: 1e8, type: 'number'},
  winRepeat: {lable: 'Win Repeat', value: 6, type: 'number'}, // number or repetitive wins before going back to basebet and basepayout

 // what happens when we lose
 // Bet Settings
  onBetLossTitle: {label: 'Loss Bet Settings', type: 'title'},
    onBetLoss: {label: '', value: '3', type: 'radio',
      options: [
        {value: '0', label: 'Return to Base Bet'},
        {value: '1', label: 'Add to Bet'},
        {value: '2', lable: 'Subtract From Bet'},
        {value: '3', lable: 'Multiply Bet By'}
      ]
    },
  addBetLoss: { label: 'Increase Bet By:', value: 0, type: 'number' },
  subBetLoss: { label: 'Decrease Bet By:', value: 0, type: 'number' },
  mulBetLoss: { label: 'Multiply Bet By:', value: 2, type: 'number' },

//Payout Settings
  onPayoutLossTitle :{label: 'Loss Payout Settings', type: 'title'},
    onPayoutLoss: {label: '', value: '0', type: 'radio',
      options: [
        {value: '0', label: 'Return to Base Payout'},
        {value: '1', label: 'Add to Payout'},
        {value: '2', lable: 'Subtract From Payout'},
        {value: '3', lable: 'Multiply Payout By'}
      ]
    },
  addPayoutLoss: { label: 'Increase Payout By:', value: 0, type: 'number' },
  subPayoutLoss: { label: 'Decrease Payout By:', value: 0, type: 'number' },
  mulPayoutLoss: { label: 'Multiply Payout By:', value: 1, type: 'number' },


// what happens if we win
// Bet Settings
  onBetWinTitle: {label: 'Win Bet Settings', type: 'title'},
    onBetWin: {label: '', value: '0', type: 'radio',
      options: [
        {value: '0', label: 'Return to Base Bet'},
        {value: '1', label: 'Add to Bet'},
        {value: '2', lable: 'Subtract From Bet'},
        {value: '3', lable: 'Multiply Bet By'}
      ]
    },
  addBetWin: { label: 'Increase Bet By:', value: 0, type: 'number' },
  subBetWin: { label: 'Decrease Bet By:', value: 0, type: 'number' },
  mulBetWin: { label: 'Multiply Bet By:', value: 1, type: 'number' },

//Payout Settings
  onPayoutWinTitle :{label: 'Win Payout Settings', type: 'title'},
    onPayoutWin: {label: '', value: '3', type: 'radio',
      options: [
        {value: '0', label: 'Return to Base Payout'},
        {value: '1', label: 'Add to Payout'},
        {value: '2', lable: 'Subtract From Payout'},
        {value: '3', lable: 'Multiply Payout By'}
      ]
    },
  addPayoutWin: { label: 'Increase Payout By:', value: 0, type: 'number' },
  subPayoutWin: { label: 'Decrease Payout By:', value: 0, type: 'number' },
  mulPayoutWin: { label: 'Multiply Payout By:', value: 2, type: 'number' },
}

// function
function main (){
  var baseBet = config.baseBet.value;
  var basePayout = config.basePayout.value;
  var currentBet = config.baseBet.value;
  var currentPayout = config.basePayout.value;
  var onBetWin = config.onBetWin.value;
  var addBetWin = config.addBetWin.value;
  var subBetWin = config.subBetWin.value;
  var mulBetWin = config.mulBetWin.value;
  var onPayoutWin = config.onPayoutWin.value;
  var addPayoutWin = config.addPayoutWin.value;
  var subPayoutWin = config.subPayoutWin.value;
  var mulPayoutWin = config.mulPayoutWin.value;
  var onBetLoss = config.onBetLoss.value;
  var addBetLoss = config.addBetLoss.value;
  var subBetLoss = config.subBetLoss.value;
  var mulBetLoss = config.mulBetLoss.value;
  var onPayoutLoss = config.onPayoutLoss.value;
  var addPayoutLoss = config.addPayoutLoss.value;
  var subPayoutLoss = config.subPayoutLoss.value;
  var mulPayoutLoss = config.mulPayoutLoss.value;
  var stopPayout = config.stopPayout.value;
  var stopBet = config.stopBet.value;
  var winRepeatCount = config.winRepeat.value
  var winRepProvision = 0
  var gameStatus = 1
  var gameCounter = 1
  
  game.onBet = function () {
    log.success('Placing Bet For: ' + currentBet + ', At Payout: '+ currentPayout)
    
    game.bet(currentBet, currentPayout).then(function (payout)
        {if (payout > 1)
            {if(!gameStatus)
                {counterReset(true)}
                    log.success('Winner, Winner, Chicken Dinner!')
                        gameStarter(onBetWinSwitch(onBetWin),onPayoutWinSwitch(onPayoutWin))
            } 
            else
            {if(gameStatus)
                {gameStatus--}
                    winRepCountReset(true) 
                        log.error('We lost that one.')
                            gameStarter(onBetLossSwitch(onBetLoss),onPayoutLossSwitch(onPayoutLoss))
                                gameCounter++
            }
  })

function gameStarter(calculatedBet, calculatedPayout)
    {if (currentBet > stopBet)
        {log.error('The bot was stopped because the max bet was reached.');
            game.stop();}
    else
    if (currentPayout > stopPayout)
        {log.error('The bot was stopped because the max payout was reached.')}
                currentBet = calculatedBet
                currentPayout = calculatedPayout
    }
function onBetWinSwitch (switchValue)
{switch(switchValue)
    {case '0':
        return baseBet
      break;
    case '1':
        if(!gameStatus)
            {if(!winRepeatCount)
                {gameStatus++
                    winRepCountReset(true)   
                        return baseBet
                }
            else
                {winRepeatCount--
                winRepProvision++
                winRepeatSet--
                    return currentBet + (addBetWin)
                }
            }
        else
            {return baseBet}
                break;
    case '2':
        if(!gameStatus)
            {if(!winRepeatCount)
                {gameStatus++
                winRepCountReset(true)   
                    return baseBet}
            else
                {winRepeatCount--
                winRepProvision++
                winRepeatSet--
                    return currentBet - (subBetWin)
                }
            }
        else
            {return baseBet}
                break;
    case '3':
        if(!gameStatus)
            {if(!winRepeatCount)
                {gameStatus++
                winRepCountReset(true)   
                    return baseBet}
            else
                {winRepeatCount--
                winRepProvision++
                winRepeatSet--
                    return currentBet * (mulBetWin)}
            }
        else
            {return baseBet}
                break;
    }
}
function onPayoutWinSwitch (switchValue)
    {switch(switchValue)
        {case '0':
            return basePayout
                break;
        case '1':
            if(!gameStatus)
                {if(!winRepeatCount)
                    {gameStatus++
                        winRepCountReset(true)   
                            return basePayout
                    }
                else
                    {winRepeatCount--
                    winRepProvision++
                    winRepeatSet--
                        return currentPayout + (addPayoutWin)
                    }
                }
        else
            {return basePayout}
                break;
    case '2':
        if(!gameStatus)
            {if(!winRepeatCount)
                {gameStatus++
                winRepCountReset(true)   
                    return basePayout}
            else
                {winRepeatCount--
                winRepProvision++
                winRepeatSet--
                    return currentPayout - (subPayoutWin)
                }
            }
        else
            {return basePayout}
                break;
    case '3':
        if(!gameStatus)
            {if(!winRepeatCount)
                {gameStatus++
                winRepCountReset(true)   
                    return basePayout}
            else
                {winRepeatCount--
                winRepProvision++
                winRepeatSet--
                    return currentPayout * (mulPayoutWin)}
            }
        else
            {return basePayout}
                break;
    }
}
function onBetLossSwitch (switchValue)
    {switch(switchValue) 
        {case '0':
            return baseBet
                break;
        case '1':
            return currentBet + (addBetLoss)
                break;
        case '2':
            return currentBet - (subBetLoss)
                break;
        case '3':
            return currentBet * (mulBetLoss)
                break;
        }
    }
function onPayoutLossSwitch (switchValue)
    {switch(switchValue) 
        {case '0':
            return basePayout
                break;
        case '1':
            return currentPayout + (addPayoutLoss)
                break;
        case '2':
            return currentPayout - (subPayoutLoss)
                break;
        case '3':
            return currentPayout * (mulPayoutLoss)
                break;
        }
    }
function counterReset(itsZero)
    {if(itsZero)
        {gameCounter--
        if(!gameCounter)
            {gameCounter++
            return}
                counterReset(true)
        }
    }
function winRepCountReset(itsZero)
    {if(!winRepProvision)
        {return}
            if(itsZero)
            {winRepeatCount++
                winRepProvision--
                    if(!winRepProvision)
                        {return}
                            winRepCountReset(true)
            }
    }


}
}

 

missing labels.PNG

Link to comment
Share on other sites

I just saw this and of course especially in a scripted language without compile time checking.

Also why are you using integers as strings.  the values you have for value will not be recognized as numbers.  I am assuming you figured this out in your switch statements and are also comparing them as strings.  But might as well make them actual integers and get rid of the string literals around them ' '

 

//Payout Settings
  onPayoutLossTitle :{label: 'Loss Payout Settings', type: 'title'},
    onPayoutLoss: {label: '', value: '0', type: 'radio',
      options: [
        {value: '0', label: 'Return to Base Payout'},
        {value: '1', label: 'Add to Payout'},
        {value: '2', lable: 'Subtract From Payout'},
        {value: '3', lable: 'Multiply Payout By'}
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...