Hello,guys.Can you tell me why my script works on bustabit, but on bustadice it gives errors "engine not defined" and "userinfo.balance not defined"? Thanks in advance.
var config = {
};
let winMatrix = [
[10, 1.35],
[10, 1.45],
[10, 1.55],
[10, 1.65],
[10, 1.75],
[10, 1.85],
[10, 1.95],
[10, 2.05],
[10, 2.15],
[10, 2.25],
[10, 2.35],
[10, 2.45],
[10, 2.55],
[10, 2.65],
[10, 2.75],
[10, 2.85],
[10, 2.95],
];
let loseMatrix = [
[50, 1.25],
[0, 1.25],
[250, 1.25],
[0, 1.25],
[1250, 1.25],
[0, 1.25],
[6250, 1.25],
[0, 1.25],
[3250, 1.25],
];
var startingBalance = userInfo.balance;
var currentBet = 0;
var currentGame = 0;
var totalGames = 0;
var winStreak = true;
var loseStreak = false;
var startingBet = currentBet;
log('Script is running.... ');
log('Starting Balance: ', startingBalance);
engine.on('GAME_STARTING', onGameStarted);
engine.on('GAME_ENDED', onGameEnded);
function onGameStarted()
{
totalGames++;
var currentBet = 0;
var cashOut = 0;
if(winStreak)
{
currentBet = winMatrix[currentGame][0]*100;
cashOut = winMatrix[currentGame][1];
}
else
{
currentBet = loseMatrix[currentGame][0]*100;
cashOut = loseMatrix[currentGame][1];
}
if (currentBet > userInfo.balance) {
log('Game KILLED BET TO BIG');
engine.removeListener('GAME_STARTING', onGameStarted);
engine.removeListener('GAME_ENDED', onGameEnded);
}
else
{
if(currentBet != 0)
{
log('Game #', currentGame, 'PLACE BET: ', roundBit(currentBet)/100, ' Cashout: ', cashOut, ' User Balance: ', userInfo.balance/100);
engine.bet(roundBit(currentBet), cashOut);
}
}
}
function onGameEnded() {
var lastGame = engine.history.first()
if (!lastGame.wager) {
log('SKIP:', lastGame.bust);
if(currentGame > 0)
currentGame++;
return;
}
if (lastGame.cashedAt)
{
log('Current Game:', currentGame, 'WON : ', (lastGame.wager/100) * (lastGame.cashedAt), ' Bust: ', lastGame.bust, ', Balance: ', userInfo.balance/100, ', Profit: ', (userInfo.balance/100) - (startingBalance/100));
if(loseStreak)
{
winStreak = true;
loseStreak = false;
currentGame=0;
}
else
currentGame++;
}
else
{
log('Current Game:', currentGame, 'LOST : ', lastGame.wager/100, ' Bust: ', lastGame.bust, ', Balance: ', userInfo.balance/100, ', Profit: ', (userInfo.balance/100) - (startingBalance/100));
if(winStreak)
{
loseStreak = true;
winStreak = false;
currentGame=0;
}
else
currentGame++;
}
var killScript = false;
if(winStreak)
{
if(currentGame >= winMatrix.length)
killScript = true;
}
else
{
if(currentGame >= loseMatrix.length)
killScript = true;
}
if(killScript)
{
log('Strategy Failed! exiting...');
engine.removeListener('GAME_STARTING', onGameStarted);
engine.removeListener('GAME_ENDED', onGameEnded);
}
}
function roundBit(bet) {
return Math.round(bet / 100) * 100;
}