newbie
Activity: 29
Merit: 0
here is a script, but it does not start. You know how to fix?
var bet = {base: 0.00001, current: 0.00001, currency: "tokens", bits:1, max:0.01, multiplier:10}; //Modify these values to change your base bet, currency may be "tokens" or "bitcoins", bits is the number of drops made
var placeBet=function(){
$.post( "action.php", { prizes: "125,20,1.52,1.42,1.32,1.32,1.22,1.12,0,1.12,1.22,1.32,1.32,1.42,1.52,20,125",
token: token,
secret:0,
bet:bet.current,
bits:bet.bits,
currency:bet.currency,
user_seed:makeid(),
act:"play",
v:ver,
})
.done(function( data ) {
if (!data.success){
alert(data.msg);
return 0;
}
var win = total_win(data.game_result.win);
var total_bet = data.game_result.total_bet;
console.log( win, data.data.balance );
if (win >= total_bet){
bet.current = bet.base;
if (bet.current < bet.base) bet.current = bet.base;
} else if (win < total_bet) {
bet.current = (bet.current-win/bet.bits) * bet.multiplier;
if (bet.current > bet.max) bet.current=bet.base;
if (bet.current < bet.base) bet.current=bet.base;
}
//Delay placing bet to not trigger rate-limiting;
var real_bet = total_bet;
if (bet.currency === "tokens") real_bet = total_bet * 0.00000001;
if (real_bet >= 0.00100000 && bet.current * bet.bits >= 0.00100000) placeBet(); //No BPS Limit at 100K
else if (real_bet >= 0.00010000 && bet.current * bet.bits >= 0.00010000) setTimeout(function(){placeBet();},67); //15 BPS Limit at 10K
else if (real_bet >= 0.00001000 && bet.current * bet.bits >= 0.00001000) setTimeout(function(){placeBet();},100); //10 BPS Limit at 1K
else if (real_bet >= 0.00000100 && bet.current * bet.bits >= 0.00000100) setTimeout(function(){placeBet();},200); //5 BPS Limit at 100
else if (real_bet >= 0.00000001 && bet.current * bet.bits >= 0.00000001) setTimeout(function(){placeBet();},334); //3 BPS Limit at 1
else setTimeout(function(){placeBet();},1000); //1 BPS Limit at 0
}).fail(function() {
setTimeout(function(){placeBet();},5000);
});
}
//re-randomize our client seed to ensure provably faireness
function makeid(){
if (typeof window.crypto !== 'undefined' && typeof window.crypto.getRandomValues === 'function'){ //Check if CSPRNG is supported
var array = new Uint32Array(16);
window.crypto.getRandomValues(array); //Set each value in the array to random 32-bit CSPRNG values
var r='';
for (var i = 0; i < array.length; i++) {
r += String(array + "-"); //Join all items in the array into a string with 256Bits of CSPRNG
}
return CryptoJS.SHA256(r).toString(); //Hash the string into a valid format for a user seed
} else {
return CryptoJS.SHA256(String(Math.random())).toString();
}
}
function total_win(win){
var total = win.reduce(function(a, b) {
return a + b;
});
return total;
}
placeBet();