Author

Topic: Adapt script (Read 388 times)

newbie
Activity: 42
Merit: 0
January 11, 2017, 05:05:17 PM
#1
Guys, can someone plz help me to adapt this LUA script to bustabit javascript? bustabit javascript means javascript with bustabit vars? code and bustabit vars are down below

Code:
basebet = 3
nextbet = basebet

-- THIS SCRIPT IS JUST FOR DOGECOIN and you can use the command debugInfo() to check your current stats

-- your balance must be at least times 2725 bigger than the base bet, but it can be bigger, never smaller

-- balance that when hit will withdraw your earnings, they will be withdrawn automatically, read all line until you read the one which configures the address, but DO NOT withdraw an amount that makes your balance smaller then the balance you started with

-- how much you want to withdraw when hitting final target (10% of this amount will be discounted as a donation to me, you are free to erase this donation that's down below, but remember that making this script took time, effort and money just to code it)

startbalance = balance
chance = 40
martimulti = 1.85
bethigh = true
low = 0
high = 0
wincount = 0
losecount = 0
losecount2 = 0
biggestLoseStreak = 0
biggestBet = 0
nextwinbet = basebet * martimulti
X = 0
Alpha = false
Beta = 0
go = false
set = false
Z = false
Alphaprofit = 0
A = false
B = 0

function dobet()

Beta += currentprofit



if !Alpha then

-- WITHDRAW SETTINGS AND DONATION SETTINGS




r=math.random(10)

if r >= 5 then
  bethigh = true
else
  bethigh = false
end

  if previousbet == basebet then
    if !win then
      losecount2 += 1
    else
      losecount2 = losecount2 - 1
    end
    if X >= 0 then
      losecount2 = 0
    end
  end

  if losecount2 < 3 then losecount3 = 0 end

  if losecount2 >= 3 then losecount3 = losecount2 end

  if losecount3 != 0 then martimulti += losecount3 / 465 end

if (win) then
   wincount += 1
  if (wincount == 1 and go) then
     nextbet = nextwinbet
    go = false
      set = false
  else
      nextbet = basebet
  end
   if (wincount == 2 and previousbet != basebet and !A) then
        nextwinbet = basebet * martimulti
        set = true
   end
    if (wincount == 2) then go = true end
  else
   if (wincount == 1 and previousbet != basebet and !A)  then
      nextwinbet = previousbet * martimulti
   else
      
   end
   wincount = 0
   nextbet = basebet
 end

if A then nextbet = basebet end

if A and previousbet == basebet then B += 1 end

if B == 10 then A = false B = 0 end

if nextwinbet >= basebet * 10 and losecount2 == 0 then nextwinbet = basebet * martimulti end

if previousbet != basebet and chance == 40 then
   if (!win) then
     losecount += 1
     wincount = 0
     X += currentprofit
     print(X)
   else
     losecount = 0
     wincount += 1
     X += currentprofit
     print(X)
  end
 end

  if (X > 0) then
   nextbet = basebet
   chance = 40
   wincount = 0
   losecount = 0
   losecount2 = 0
   losecount3 = 0
   martimulti = 1.85
   nextwinbet = basebet * martimulti
   X = 0
   martimulti = 1.85
   Alphaprofit = 0
  end

 if losecount == 4 and chance == 40 and !win then
   losecount = 0
   A = true
   nextbet = basebet
   Z = true
end

if Z then
chance = 70
Alpha = false

  if win then
    chance = 70
    C = 0
    nextbet = basebet
    losecount = 0
    X += currentprofit
    print(X)
  else
  if !A then
    nextbet = previousbet * 4
    losecount += 1
  end
    X += currentprofit
    print(X)
  end

  if (losecount == 1) then
    chance = 70
  end

  if (losecount == 2) then
    chance = 75
  end

  if losecount == 3 then
    nextbet = basebet / 3
    Alphaprofit = 0
    Alpha = true
  end

  if X > 0 then
   A = true
   B = 0
   chance = 40
   nextbet = basebet
   wincount = 0
   losecount = 0
   X = 0
   martimulti = 1.85
   Alphaprofit = 0
   Z = false
  end
end

  if (losecount > biggestLoseStreak) then
    biggestLoseStreak = losecount
  end

  if (nextbet > biggestBet) then
    biggestBet = nextbet
  end

function debugInfo()
  print("Bets Made = " ..  bets)
  print("Biggest Bet = " ..  string.format("%9.8f", biggestBet))
  print("Total Profit = " .. string.format("%9.8f", profit))
end

else
chance = 66
Z = false

  if win then
    nextbet = previousbet * 1.05
    Alphaprofit += currentprofit
    X += currentprofit
    print(X)
    losecount = 0
  else
    nextbet = previousbet * 1.1
    Alphaprofit += currentprofit
    X += currentprofit
    print(X)
    losecount += 1
  end

if Alphaprofit >= basebet * 1.5 then Alphaprofit = 0 nextbet = basebet / 3 end

  if X > 0 then
   nextbet = basebet
   Alphaprofit = 0
   A = true
   B = 0
   Alpha = false
   resetseed()
   Z = true
  end

  if -Alphaprofit > startbalance / 50 then
    nextbet = basebet
    wincount = 0
    losecount = 0
    losecount2 = 0
    X = 0
    chance = 40
    martimulti = 1.85
    Alphaprofit = 0
    resetseed()
    A = true
    B = 0
    Z = false
    Alpha = false
  end

function debugInfo()
  print("Bets Made = " ..  bets)
  print("Biggest Bet = " ..  string.format("%9.8f", biggestBet))
  print("Total Profit = " .. string.format("%9.8f", profit))
end

end
end

Quote
// This strategy editor is in BETA mode, please
// exercise extreme caution and use exclusively at
// your own risk. No bets can or will be refunded in
// case of errors.

// Please note the strategy editor executes arbitrary
// javascript without a sandbox and as such, only use
// strategies from trusted sources, as they can be
// backdoored to lose all your money or have
// intentional exploitable weaknesses etc.

// To see the full engine API see this mirror:
///https://github.com/kungfuant/webserver/blob/master/client_new/scripts/game-logic/script-controller.js

//Engine events:

engine.on('game_starting', function(info) {
    console.log('Game Starting in ' + info.time_till_start);
});

engine.on('game_started', function(data) {
    console.log('Game Started', data);
});

engine.on('game_crash', function(data) {
    console.log('Game crashed at ', data.game_crash);
});

engine.on('player_bet', function(data) {
    console.log('The player ', data.username, ' placed a bet. This player could be me Shocked.')
});

engine.on('cashed_out', function(resp) {
    console.log('The player ', resp.username, ' cashed out. This could be me.');
});

engine.on('msg', function(data) {
    console.log('Chat message!...');
});

engine.on('connect', function() {
    console.log('Client connected, this wont happen when you run the script');
});

engine.on('disconnect', function() {
    console.log('Client disconnected');
});


//Getters:
console.log('Balance: ' + engine.getBalance());
console.log('The current payout is: ' + engine.getCurrentPayout());
console.log('My username is: ', engine.getUsername());
console.log('The max current bet is: ', engine.getMaxBet()/100, ' Bits');
console.log('The current maxWin is: ', engine.getMaxWin()/100, ' Bits');
// engine.getEngine() for raw engine


//Helpers:
console.log('Was the last game played? ', engine.lastGamePlayed()?'Yes':'No');
console.log('Last game status: ', engine.lastGamePlay());


//Actions:
//Do this between the 'game_starting' and 'game_started' events
//engine.placeBet(betInSatoshis, autoCashOutinPercent, autoPlay);

//engine.cashOut(); //Do this when playing
//engine.stop(); //Stops the strategy
//engine.chat('Hello Spam');
Jump to: