Jump to content

Help adapting lua script to bc.game language


Lustrous Griz

Recommended Posts

Hi, I'm interested in learning how to code in this casino for use in hash dice. Currently I got this lua script and I would like to know if it is posibble to adapt it for this casino:

highestProfit = 0;
sessionProfit = 0;
allTimeHigh   = 0;
chance        = 19  
base          = balance*0.00000001  --example basebet
nextbet       = base
function dobet()
    if win then
        nextbet = previousbet*1.07
    else
        nextbet = previousbet*1.01
    end
    if (currentstreak==2) then
        nextbet = nextbet*0.77
    end
    if (currentstreak==3) then
        nextbet = nextbet*0.77
    end
    if (currentstreak==4) then
        nextbet = nextbet*0.77
    end
    if (currentstreak==5) then
        nextbet = nextbet*0.77
    end
    if bets % 10 == 0 then
        nextbet = nextbet*0.93
    end
    if nextbet <= base then
        nextbet = base
    end 
    if (profit>highestProfit) then  --triggers reset whenever there is any profit
        highestProfit = profit
        base          = balance*0.00000001  --updates basebet according to profit
        nextbet       = base
    end
end

 

Link to comment
Share on other sites

I'm trying a script but I think I'm doing something wrong, can you help me?

//Bc Game Hash Dice 

var config = {
 baseBet: { label: "base bet", value:
currency.minAmount, type: "number" },
  //payout: { label: "payout", value: 2, type: "number" },
  minChange: { label: "min change", value: 1, type:
"number" },
   maxChance: { label: "max cahge", value:98, type:
"number" },
  stop: { label: "stop if bet >", value: 1e8, type: "number" },
  balanceRisk: { label: "balance risk %", value: 100, type:
"number" },
  targetProfit: {label:'Target-Profit-Stop; value: 1000,
type:'number'},
  targetBalance: {label:'Target-Balance-Stop; value:
1000, type:'number'},
  onLoseTitle: { label: "On Lose", type: "title" },
  onLoss: {
    label: "",
    value: "reset",
    type:"radio",
    options: { 
      { value: "reset", label: "Return to base bet" },
      { value: "increase", label: "lncrease bet by (loss
multiplier)" },
    },
  },
  lossStreak: { label: "loss streak", value:2, type: "number"
},
 lossMultiplier: { label: "loss multiplier", value: 2, type:
"number" },
  onWinTitle: { label: "On Win", type: "title" },
  onWin: {
    label: "",
    value: "reset",
    type: "radio",
    options: {
      { value: "reset", label: "Return to base bet" },
      { value: "increase", label: "increase bet by (win
multiplier)" },
    },
  },
  winStreak: { label: "win streak", value: 2, type: "number"
},
  winMultiplier: { label: "win multiplier", value: 2, type:
"number" },
};

var run = false;
//var bet = currency.amount/config.divider.value;
var bet = config.baseBet.value;
var basebet = bet;
var startTime = new Date();
var timestring = ";
var roundWins = 0;
var roundLosses = 0;
var chance = Math.random() * (config.maxChance.value   
- config.minChance.value) + config.minChance.value;
var currentProfitt = 0;
var currentProfittt = 0;
var curProf = 0;
var profitTotal = 0;
var balance = currency.amount;
var lastbalance = balance;

function main (){
  run = true;
  var currentBet = config.baseBet.value;
  game.onBet = function () {
        //balance = currency.amount;
        //if(balance >= lastbalance) lastbalance = balance;
        chance = Math.random() *
(config.maxChance.value - config.minChance.value) +
config.minChance.value;
    //game.bet(currentBet;
config.payout.value).then(function (payout) {
        game.bet(currentBet,
(99/chance).toFixed(4)).then(function (payout) {
                /*
          currentProfit += curProf;
          if (currentProfitt >= currentProfittt) {
        currentProfittt = currentProfittt;
                currentBet = config.baseBet.value;
                roundWins = 0;
                roundLosses = 0;
          }
          */
           
         if (payout > 1) {
                 balance += currentBet*99/chance-currentBet;
                 profitTotal += currentBet*99/chance-
currentBet;
         }else{
                 balance -= currentBet;
                 profitTotal -= currentBet;
         }
         if(balance >= lastbalance) lastbalance = balance;

       if (payout > 1) {
                 curProf = currentBet*99/chance-currentBet;
                 roundWins++;
         if (config.onWin.value === "reset") {
           currentBet = config.baseBet.value;
         } else {
           //currentBet *= config.winMultiplier.value;
                   if (roundWins % config.winStreak.value === 0)  
{
                         currentBet *= config.winMultiplier.value;
                   }
         }
         log.success(
           "We won, so next bet will be " +
             currentBet +
             " " +
             currency.currencyName
        );
      } else {
                curProf = -currentBet;
                roundLosses++;
        if (config.onLoss.value === "reset") {
          currentBet = config.baseBet.value;
        } else {
          //currentBet *= config.lossMultiplier.value;
                  if (roundLosses % config.lossStreak.value ===
0) {
                       currentBet *= config.lossMuliplier.value;
                  }
       }
       log.error(
         "We lost, so next bet will be " +
           currentBet +
           " " +
           currency.currencyName
        );
      }
         
         currentProfitt += curProf;
         if (currentProfitt >= currentProfittt) {
       currentProfittt = currentProfitt;
              currentBet = config.baseBet.value;
              roundWins = 0;
              roundLosses = 0;
         }
        
         if (currentBet < config.baseBet.value) {
                 currentBet = config.baseBet.value
         }
        
         var stoplevel = (100-
config.balanceRisk.value)*lastbalance/100;
          if(balance - currentBet < stoplevel){
         log.error(
           "Balance Risk " + currentBet + "Stop"
       );
       game.stop();
     }

     if (currentBet > config.stop.value) {
       log.error(
         "Was about to bet " + currentBet + " which triggers   
the stop"
        );
        game.stop();
      }

          if (currentBet > balance) {
        log.error(
          "Loss " + balance + "which triggers the stop"
        );
        game stop();
       }

         if (profitTotal >= config.targetProfit.value) {
                       //bet =
currency.amount/config.divider.value;
                        log.success('Target Profit ' +
(profitTotal).toFixed(8) + ' ' + currency.currencyName);
                        game.stop();
         }

         if (balance >= config.targetBalance.value) {
                       //bet =
currency.amount/config.divider.value;
                        log.success('Target Balance ' + balance + ' '
+ currency.currencyName);
                        game.stop();
         }

   ));
 );
}

setinterval(function(){
    var cur = new Date();
    var t = Math.floor((cur - startTime) / 1000);
    var hour = Math.floor(t / 3600);
    if (hour < 10) hour = '0' + Math.floor(t / 3600);
    t = t % 3600;
    var minutes = Math.floor(t / 60);
    if (minutes <10) minutes = '0' + t % 60;
        if(run) timestring = 'PlayTime ' + hour + ':' + minutes + ':' + seconds + ' ';
        else timestring = ";
},'1000');

 
Link to comment
Share on other sites

Did you read my post? I don't know how to script for this casino yet,
 

If I understand correctly, this line might be the issue, as it would trigger to stop betting if your bet is higher than a satoshi lol.

 stop: { label: "stop if bet >", value: 1e8, type: "number" }, 

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...