Professional Documents
Culture Documents
1
-- Constant Profit on every win with tipping and logging
--
-- This script tries to win at least "Payout X Amount" over what has been spent for
every win.
--
-- For example, basechance of 1.2345 = 96.680 payout X, so every win will be
"Around" 96 above what was spent.
-- Due to the decimal point resolution, it will never be exact. It may be more or
less than the Payout X.
--
-- basechance > 25, may result in negative payouts on long red runs, but short runs
will still be positive.
--
-- basechance can be used in the console during run-time to change your payout
after the next win.
-- Example: basechance = 0.2048
-- That will change your payout to 483.3984 after the next win.
--
-- incDivisor variable: Controls winMult calculation based on your balance
-- Changing this variable is not advisable
-- Any balance under 10 million sats (or 10 million tokens on Bitvest) will result
in a starting bet of 1
-- Any balance over 10 million will result in a starting run bet of 1 + balance /
incDivisor
-- Example: balance = 11256780, winMult would be 1.12 ... or balance = 23456780,
winmult would be 2.34
--
-- If there are more than Payout X number of losing rolls, then the winMult is set
to 1, to just get
-- through this streak without busting, but will still profit around Payout X
amount.
--
-- chanceInc variable: increase your chance to win by X amount
-- Set to zero to stop the increment of base chance selected for the run
--
-- Example: balance = 2345678, basechance = 9.9 = Payout X of 10.00, First 10
rolls, winMult = 2.34.
-- after 10 losing rolls, the winMult value will be forced to 1.0, resulting in an
overall profit of around 10, instead of 23.4
--
-- Version 5.1 additions:
-- High / Low betting Enable / dissable
-- Set high or low bet on first bet
restTime = 0.0 -- How long to wait in seconds before the next bet. Some sites need
this
-- Bitvest setting 0.75 for low bet values
maxWinMult = 512 -- Max multiplier to hit. siteMaxProfit can lower this value Set
to 0 to disable
maxbet = 0 -- raise for higher betting. 10x basebet seems good so far. Set to 0
to disable
minbet = 1-- Use whole integers
basebet = 1 -- Use whole integers
tippedOut = 0
-- *************** This will create a log file in the directory where dicebot is
run from! *****************
tempCalc = balance
if(isTokens == false) then
tempCalc = tempCalc * 100000000
end
tempMult = tempCalc / incDivisor
if(tempMult < 1) then tempMult = 1 end
winMult = tempMult
totalProfit = 0
winMult = 1 -- Multiplier for X times over chance win
tempWinMult = winMult
incroll = 0
startBalance = balance
oldBaseChance = 0
currentStep = 0
lossCount = 0
stepCount = 0
spent = 0
highLowLossCount = 0
highLowAverage = {}
averageCount = 0
averageIndex = 0
averageMax = 8 -- High / Low average switching.
rollCount = 0
rollSeedCount = 0
profit = 0
function calcChance()
if(oldBaseChance == 0) then oldBaseChance = basechance end
if(win) then
if(lastBet.Roll >= 50) then
target = 100 - lastBet.Roll
else
target = lastBet.Roll
end
highLowAverage[averageCount] = target
averageCount = averageCount + 1
if(averageCount >= averageMax) then averageCount = 0 end
tempAverage = 0
for i=0, averageMax do
tempAverage = tempAverage + highLowAverage[i]
end
tempAverage = tempAverage / averageMax
-- chance = tempAverage * chanceMult
chance = tempAverage
if(chance > (oldBaseChance * chanceMax)) then chance = oldBaseChance *
chanceMax end
tempcalc = string.format("Temp Average: %.4f / chance: %.4f", tempAverage,
chance)
print(tempcalc)
else
winAmount = (100 - (100 * (housePercent / 100))) / chance -- how much you
will win for a 1 bet
if(lossCount > winAmount) then
chance = chance + chanceInc
tempcalc = string.format("New chance: %.4f", chance)
-- print(tempcalc)
end
end
end
function autoTune()
-- Auto tune to win at least minWinAmount
tempstr = "Win Amount: winAmount, Needed: amtNeeded, Next Mult: nextmult, Next
Bet: nextbet"
winAmount = (100 - (100 * (housePercent / 100))) / chance -- how much you will
win for a 1 bet
if(isTokens == false) then
winAmount = winAmount * 0.00000001
end
tempcalc = string.format("%.8f", winAmount)
tempstr = string.gsub(tempstr, "winAmount", tempcalc)
tempcalc = 1 + ((chance / 100) * ((100 - housePercent) / ((100 -
housePercent) / 2)))
needed = (winAmount * tempWinMult) + (nextbet * tempcalc) + spent -- No need to
go by balance for next bet. Only how much has been spent. Will allow tipping and
not accidentally bust
chance = basechance
nextbet=basebet
autoTune()
function logWin(opposite)
if(enableLogging == true) then
tempstr = "year-0month-0day 0hour:0minute:0second, betid, streak, bet,
chance, spent, winamount, profit, roll, highlo opposite"
tempstr = string.gsub(tempstr, "year", lastBet.date.year)
if (lastBet.date.month >= 10) then tempstr = string.gsub(tempstr, "0month",
"month") end
if (lastBet.date.day >= 10) then tempstr = string.gsub(tempstr, "0day",
"day") end
if (lastBet.date.hour >= 10) then tempstr = string.gsub(tempstr, "0hour",
"hour") end
if (lastBet.date.minute >= 10) then tempstr = string.gsub(tempstr,
"0minute", "minute") end
if (lastBet.date.second >= 10) then tempstr = string.gsub(tempstr,
"0second", "second") end
tempstr = string.gsub(tempstr, "month", lastBet.date.month)
tempstr = string.gsub(tempstr, "day", lastBet.date.day)
tempstr = string.gsub(tempstr, "hour", lastBet.date.hour)
tempstr = string.gsub(tempstr, "minute", lastBet.date.minute)
tempstr = string.gsub(tempstr, "second", lastBet.date.second)
tempstr = string.gsub(tempstr, "betid", lastBet.Id)
if(lossCount < 10000) then tempstr = string.gsub(tempstr, "streak", "
streak") end
if(lossCount < 1000) then tempstr = string.gsub(tempstr, "streak", "
streak") end
if(lossCount < 100) then tempstr = string.gsub(tempstr, "streak", "
streak") end
if(lossCount < 10) then tempstr = string.gsub(tempstr, "streak", " streak")
end
tempstr = string.gsub(tempstr, "streak", lossCount)
tempcalc = string.format("%.8f", nextbet)
tempstr = string.gsub(tempstr, "bet", tempcalc)
if(chance < 10) then
tempcalc = string.format(" %.4f", chance)
else
tempcalc = string.format("%.4f", chance)
end
tempstr = string.gsub(tempstr, "chance", tempcalc)
tempcalc = string.format("%.8f", spent)
tempstr = string.gsub(tempstr, "spent", tempcalc)
tempcalc = string.format("%.8f", lastBet.Profit)
tempstr = string.gsub(tempstr, "winamount", tempcalc)
profit = lastBet.Profit - spent
tempcalc = string.format("%.8f", profit)
tempstr = string.gsub(tempstr, "profit", tempcalc)
if(lastBet.Roll < 10) then
tempstr = string.gsub(tempstr, "roll", string.format(" %.4f",
lastBet.Roll))
else
tempstr = string.gsub(tempstr, "roll", string.format("%.4f",
lastBet.Roll))
end
tipstr = ""
if(autotip == true and isTokens == false and bankroll != 0) then
tipvalue = bankroll + tipamount + (tipamount * bankappend)
pct = ((balance - bankroll) / (tipvalue - bankroll)) * 100
if(win and isHunting == true) then
tipstr = string.format(" ... Percent towards tip: %.2f to %s! ...
Total Tipped: %.8f\n", pct, receiver, totalTipped)
end
end
fout:close()
os.remove(filename)
os.rename(tempfile, filename)
end
end
function dobet()
if win then
logTest = rollLog
if(rollLog == 0) then
logTest = (100 - (100 * (housePercent / 100))) / chance
end
-- print(logTest)
tipvalue = bankroll + tipamount + (tipamount * bankappend)
pct = ((balance - bankroll) / (tipvalue - bankroll)) * 100
if isTokens == false and autotip == true then
print(string.format("Percent of next tip won: %.2f", pct))
end
if(enableLogging == true and lossCount >= logTest) then
logWin(false)
-- tempstr = "year-0month-0day 0hour:0minute:0second, betid, streak, bet,
chance, spent, winamount, profit, roll, highlo\n"
-- tempstr = string.gsub(tempstr, "year", lastBet.date.year)
-- if (lastBet.date.month >= 10) then tempstr = string.gsub(tempstr,
"0month", "month") end
-- if (lastBet.date.day >= 10) then tempstr = string.gsub(tempstr, "0day",
"day") end
-- if (lastBet.date.hour >= 10) then tempstr = string.gsub(tempstr,
"0hour", "hour") end
-- if (lastBet.date.minute >= 10) then tempstr = string.gsub(tempstr,
"0minute", "minute") end
-- if (lastBet.date.second >= 10) then tempstr = string.gsub(tempstr,
"0second", "second") end
-- tempstr = string.gsub(tempstr, "month", lastBet.date.month)
-- tempstr = string.gsub(tempstr, "day", lastBet.date.day)
-- tempstr = string.gsub(tempstr, "hour", lastBet.date.hour)
-- tempstr = string.gsub(tempstr, "minute", lastBet.date.minute)
-- tempstr = string.gsub(tempstr, "second", lastBet.date.second)
-- tempstr = string.gsub(tempstr, "betid", lastBet.Id)
-- tempstr = string.gsub(tempstr, "streak", lossCount)
-- tempcalc = string.format("%.8f", nextbet)
-- tempstr = string.gsub(tempstr, "bet", tempcalc)
-- tempcalc = string.format("%.2f", chance)
-- tempstr = string.gsub(tempstr, "chance", tempcalc)
-- tempcalc = string.format("%.8f", spent)
-- tempstr = string.gsub(tempstr, "spent", tempcalc)
-- tempcalc = string.format("%.8f", lastBet.Profit)
-- tempstr = string.gsub(tempstr, "winamount", tempcalc)
-- profit = lastBet.Profit - spent
-- tempcalc = string.format("%.8f", profit)
-- tempstr = string.gsub(tempstr, "profit", tempcalc)
-- tempstr = string.gsub(tempstr, "roll", lastBet.Roll)
-- if(bethigh == true) then
-- tempstr = string.gsub(tempstr, "highlo", "Betting High")
-- else
-- tempstr = string.gsub(tempstr, "highlo", "Betting Low")
-- end
-- -- print(tempstr)
--
-- fin = assert(io.open(filename, "r"))
-- content = fin:read("*a")
-- fin:close()
--
-- fout = assert(io.open(tempfile, "w"))
-- fout:write(content)
-- fout:write(tempstr)
-- -- fout:write(oppositeOut)
--
-- fout:close()
-- os.remove(filename)
-- os.rename(tempfile, filename)
end
chance = basechance
lossCount = 0 -- reset
stepCount = 0 -- reset
spent = 0
highLowLossCount = 0
startBalance = balance
tempCalc = balance
if(isTokens == false) then
tempCalc = tempCalc * 100000000
end
tempMult = tempCalc / incDivisor
fout:close()
os.remove(filename)
os.rename(tempfile, filename)
end
print("Balance too low for the bet. Stopping.")
stop()
print("Resetting")
chance = basechance
lossCount = 0 -- reset
nextbet = basebet -- reset
stepCount = 0 -- reset
spent = 0
end
end
sleep(restTime)
end