Last active
November 17, 2021 22:05
-
-
Save ruzli/c1bfccc55a24cc6894067193280035b9 to your computer and use it in GitHub Desktop.
CompoundScript [~~~Script by Daffie! Added two features [trailing stop & max bet reset] by Ruzli~~~]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = { | |
headerCommon: { label: "Common Settings", type: "noop", value: "" }, | |
baseBet: { label: 'Base Bet', type: 'balance', value: 1000 }, | |
minPayout: { label: 'Target Min', type: 'multiplier', value: 1.08 }, | |
maxPayout: { label: 'Target Max', type: 'multiplier', value: 50.00 }, | |
divPayout: { label: 'Target Div', type: 'multiplier', value: 0.80 }, | |
compRate: { label: 'Compound %', type: 'multiplier', value: 0.02 }, | |
compStep: { label: 'Compound At', type: 'multiplier', value: 1.10 }, | |
headerCond: { label: "Conditions Settings", type: "noop", value: "" }, | |
onResetWager: { label: "Wager Reset At[0 = OFF]", type: "balance", value: 2000 }, | |
stopLoss: { label: "Stop if lose more than[0 = OFF]", type: "balance", value: -100000 }, | |
headerRest: { label: "Rest Settings", type: "noop", value: "" }, | |
betSpeed: { label: 'Bet Speed', type: 'multiplier', value: 100 }, | |
simMode: { label: 'Sim Mode', type: 'checkbox', value: false }, | |
simBal: { label: 'Sim Balance', type: 'balance', value: 1000000 }, | |
}; | |
Object.entries(config).forEach((c) => window[c[0]] = c[1].value); | |
let currentBet = baseBet, currentPayout = minPayout, lastPayout, baseMulti = 1.005, betMulti = 1.006, origBal = this.balance, gameNum = 1; | |
let startBal = this.balance, lastBal = startBal, nextBal = startBal * compStep, comp = 0; | |
var lprofit = 0; | |
var stopLoss = config.stopLoss.value; | |
function roundBit(bet) { return Math.max(100, Math.round((bet) / 100) * 100) } | |
const sleep = (ms) => { return new Promise(r => setTimeout(r, ms)); } | |
if (simMode) { | |
var simBalance = simBal; | |
this.balance = simBalance; | |
origBal = simBalance; | |
this.bet = (value, target) => { | |
if (this.balance !== simBalance) this.balance = simBalance; | |
return new Promise(async (resolve, reject) => { | |
if (value % 100 != 0) return reject("bet size must be evenly divisible by 100"); | |
if (value < 100) return reject("bet size must be at least 100 (= 1 bit)"); | |
if (target < 1.01 || target > 1e6) return reject("target multiplier must be between 1.01 and 1,000,000"); | |
if (this.balance && this.balance < value) return reject("insufficient balance"); else if (!this.balance) this.balance = 0; | |
let id = (++this.fid || (this.fid = 0, 0)), timestamp = new Date().toDateString(); | |
let multiplier = Math.round(Math.max(1, (0.99 / Math.random())) * 1e2) / 1e2; | |
if (multiplier < target) { this.balance -= value; } else { this.balance += value * (target - 1); } | |
simBalance = this.balance; | |
await sleep(betSpeed); | |
let result = { id: id, timestamp: timestamp, value: value, target: target, multiplier: multiplier, balance: this.balance, bankroll: Infinity }; | |
return resolve(result); | |
}).catch((r) => { throw new Error(r); }); | |
} | |
} | |
for(;;){ | |
if (lprofit < stopLoss && stopLoss != 0) { | |
this.log("Stop loss triggered"); | |
this.stop(); | |
} | |
if (roundBit(currentBet + comp) > config.onResetWager.value && config.onResetWager.value != 0) { currentBet = config.baseBet.value; } // AT MAX WAGER RESET WAGER TO BASE WAGER | |
let logMsg = `[#${gameNum}]Bet ${Math.round((currentBet + comp) / 100).toFixed(2)} bits @ ${currentPayout.toFixed(2)}x. `; | |
const result = await this.bet(roundBit(currentBet + comp), currentPayout); | |
logMsg += `Rolled ${result.multiplier}x and `; | |
if (result.multiplier < currentPayout){ | |
lprofit -= roundBit(currentBet + comp); | |
logMsg += `lost ${(result.value/100).toFixed(2)} bits wager. `; | |
if(currentPayout >= maxPayout){ | |
lastPayout = currentPayout, currentPayout *= (1 - divPayout); | |
currentBet *= (lastPayout / (currentPayout - 1)); | |
}else{ currentPayout += baseMulti, currentBet *= betMulti; } | |
}else{ | |
lprofit = 0; | |
logMsg += `won ${(result.value*(result.target-1)/100).toFixed(2)} bits profit. `; | |
currentPayout = minPayout, currentBet = baseBet; | |
if(this.balance >= nextBal){ comp = 0, nextBal = (lastBal * compStep) | |
}else{ comp = (this.balance - lastBal) * compRate, lastBal = this.balance; } | |
} | |
logMsg += `(Balance: ${(this.balance/100).toFixed(2)}, Profit: ${((this.balance-origBal)/100).toFixed(2)} bits)`; | |
this.log(logMsg); gameNum++; | |
await sleep(betSpeed) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment