Skip to content

Instantly share code, notes, and snippets.

@dsetzer
dsetzer / bab_to_ether-dice.js
Created March 21, 2021 22:36
Script wrapper for running bustabit scripts on ether-dice. This expects the bustabit script to be standard format where bets are placed at GAME_STARTING event. Scripts with everything in GAME_ENDED will skip endlessly. Also don't expect any Ruzli scripts to work, it's a miracle those run to begin with.
engine.bet=function(e,n){this.nextBet={value:e,target:n}},engine.getState=(()=>{}),engine.cashOut=(()=>{});const gameResultFromHash=()=>{},SHA256=()=>{};engine.history={first(){let e=engine.nextResult;if(e||(e=engine.getLastGamePlayed),e){let n={id:e.id,hash:e.hash,bust:e.crash};return["NOT_PLAYED","SKIPPED"].includes(engine.getLastGamePlay)||(n.wager=e.wager,e.cashout<=e.crash&&(n.cashedAt=e.cashout)),n}return{id:0,hash:"none",bust:0,wager:0,cashedAt:0}}};const log=console.log,stop=engine.stop,userInfo={get uname(){},get balance(){return engine.getBalance}};engine.on("script_started",()=>{setTimeout(async()=>{for(;;)engine.nextBet=null,engine.nextResult=null,await engine.emit("GAME_STARTING"),null!==engine.nextBet?(engine.emit("BET_PLACED",{uname:"temp",wager:engine.nextBet.value,payout:engine.nextBet.target}),engine.nextResult=await engine.placeBet(engine.nextBet.value,engine.nextBet.target)):engine.nextResult=await engine.skip(),engine.emit("GAME_STARTED"),"WON"===engine.getLastGamePlay&&engine.emit("CASHE
@dsetzer
dsetzer / bustadice-sim-mode.js
Last active October 30, 2020 20:41
Sim mode for bustadice based on my previous diceBetSimulate gist but easier to drop into a script and instructions.
/************* INSTRUCTIONS *************
Place it into a script right below the config section at the top and it will replace
the bet/skip function with mock functions which don't interact with the server.
A few points to note:
1. Latency won't exist with these, and results are returned almost instantly, this
could cause the browser to freeze up or make the script unobservable unless the
script includes a sleep or bet delay function. For convenience there's one included
but disabled by default, just enable the SIM_MODE_SLEEP setting.