Skip to content

Instantly share code, notes, and snippets.

@zundra
Created June 30, 2021 18:22
Show Gist options
  • Save zundra/b6dd2b620cbc23803fc744de2ddf0aa5 to your computer and use it in GitHub Desktop.
Save zundra/b6dd2b620cbc23803fc744de2ddf0aa5 to your computer and use it in GitHub Desktop.
Bust below threshold watch
var config = {
bust_threshold: { value: 2, type: "multiplier", label: "Count busts below this value and bet after <n> busts" },
bust_threshold_limit: { value: 5, type: "multiplier", label: "How many busts to track below threshold before betting" },
};
var stateVars = {
bustCountBelowThreshold: 0
};
log("Script is running..");
engine.on("GAME_STARTING", onGameStarted);
engine.once("GAME_STARTING", () => engine.on("GAME_ENDED", onGameEnded));
function onGameStarted() {
log("The current bust count is ", stateVars.bustCountBelowThreshold);
log("The current bust limit is ", config.bust_threshold_limit.value);
if (stateVars.bustCountBelowThreshold >= config.bust_threshold_limit.value)
{
log("Detected a loss above threshold [", stateVars.bustCountBelowThreshold, "]")
}
}
function onGameEnded() {
var lastGame = engine.history.first();
if (lastGame.bust <= config.bust_threshold.value)
{
stateVars.bustCountBelowThreshold++;
}
else
{
stateVars.bustCountBelowThreshold = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment