--[[Nigerian Princess wagering script by Ghostnipple This script was written in javascript for Mydicebot which is a fork of Dicebot --]] balance = 1500 target = balance*1.25 limite = balance*0.25 basebet = 0.5; bethigh = false; nextbet = basebet; pr = 0 --memorizes profit/progression prinitiale = pr frequence_affichage = 1000 --displays simulation info every 100 bets for example initBet = basebet; initPay = 10; --this is starting payout target. betIncrease = 0.08; --this is what is added to the base bet on each loss, it is not a percentage value. payDecrease = 1; --this is the decreasing payout amount, it is not a percentage value. currentBet = initBet; currentPayout = initPay; function getChance(multiplier) return 100 / multiplier; end chance = getChance(10); bb = nextbet; bbDB = bb; startbank = balance; function simuInfo() print("#=========================================#") print(" #---===--- BlindHoodFibo! ---===---# ") print("#=========================================#") print("# [Startbalance = " ..string.format("%9.8f", startbank) .. " ]-") print("# [Basebet = " ..string.format("%9.8f", bbDB) .. " ]-") print("#=========================================#") print("# [Chance: " ..string.format("%9.8f", chance) .. " ]-") print("# [nextbet: " ..string.format("%9.8f", nextbet) .." ROLL n° " ..bets .." ]-") print("#----------------------------------------------------------------------------------#") print("# [profit: " ..string.format("%9.8f", profit) .." (balance x" ..string.format("%2.2f",((balance)/(startbank))) ..") ]-") print("# [Max bet wager used: " ..string.format("%9.8f", maxUse) .. " ]-") print("# [wagered: " ..string.format("%9.8f", wagered) .." (" ..string.format("%2.2f",wagered/(startbank)) .." x start balance) ]-") print("# [Avg profit/bet: " ..string.format("%9.8f", profit/bets/bbDB) .." x base bet ]-") print("# [Avg wag/bet: " ..string.format("%9.8f", wagered/bets) .." ]-") --print("# [PROFIT MAX= " ..bestID .." ]-") --print("# [PERTE MAX= " ..badID .." ]-") print("#=========================================#\n\n\n") end perteP = 0 p = false maxUse = 0 bestID,badID,pirePERTE,bestPROFIT=0,0,0,0 function calculPrint() if p == true then --print(balance) print(chance) print(nextbet) print(coef) end perteP +=currentprofit if perteP >= 0 then perteP = 0 end if -perteP + nextbet > maxUse then maxUse = -perteP + nextbet end if bets%frequence_affichage==0 then simuInfo() end if currentprofit >= bestPROFIT then bestID = lastBet.id bestPROFIT = currentprofit end if currentprofit <= pirePERTE then badID = lastBet.id pirePERTE = currentprofit end end function limiteSTOP(target,limite) if balance > target then simuInfo() print("TARGET REACHED !!!!!!!!!!!!!!") stop() elseif balance-nextbet < limite then simuInfo() print(".............................") stop() end end function dobet() pr +=currentprofit if (win) then currentBet = basebet; currentPayout = initPay; else currentBet = currentBet + betIncrease; currentPayout = currentPayout - payDecrease; end nextbet = currentBet; chance = getChance(currentPayout); --print("Target: "..currentPayout.."x".. " | ".."Outcome: "..round(100 / lastBet.Roll, 2).."x"); limiteSTOP(); calculPrint(); end function round(number, decimals) dec = decimals - 1; dec2 = 10 / (10 * dec); output = number - ((number * 100) % dec2) / 100; return output; end
Write, Run & Share Lua code online using OneCompiler's Lua online compiler for free. It's one of the robust, feature-rich online compilers for Lua language, running the latest Lua version 5.4. Getting started with the OneCompiler's Lua editor is easy and fast. The editor shows sample boilerplate code when you choose language as Lua and start coding.
OneCompiler's Lua online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample Lua program which takes name as input and prints hello message with your name.
name = io.read("*a")
print ("Hello ", name)
Lua is a light weight embeddable scripting language which is built on top of C. It is used in almost all kind of applications like games, web applications, mobile applications, image processing etc. It's a very powerful, fast, easy to learn, open-source scripting language.
-- global variables
a = 10
-- local variables
local x = 30
Value Type | Description |
---|---|
number | Represents numbers |
string | Represents text |
nil | Differentiates values whether it has data or not |
boolean | Value can be either true or false |
function | Represents a sub-routine |
userdata | Represents arbitary C data |
thread | Represents independent threads of execution. |
table | Can hold any value except nil |
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while(condition)
do
--code
end
Repeat-Until is also used to iterate a set of statements based on a condition. It is very similar to Do-While, it is mostly used when you need to execute the statements atleast once.
repeat
--code
until( condition )
For loop is used to iterate a set of statements based on a condition.
for init,max/min value, increment
do
--code
end
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increase re-usuability and modularity.
optional_function_scope function function_name( argument1, argument2, argument3........, argumentn)
--code
return params with comma seperated
end