Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Is this non-cheating autoroller possible with LUA?


I have no knowledge about LUA. I'd like to make an autoroller which does not cheat, but exactly do what I do, only faster. Below autorolling would feel cheat free for me :-)

a) reroll like 100 times, until I get tired of it
b) 10% chance to miss some good rolls by accidentally clicking over it
c) I'd like to have the autoroll button available only one click per character

Pseudo code:

max = roll();
for i = 1 to 100
x = roll();
if ((x > max) && ((random 1) > 0.1) then max = x;



  • lefreutlefreut Member Posts: 1,462
    edited November 2019

    Post edited by lefreut on
  • tortuosittortuosit Member Posts: 63
    edited December 2016
    Oh great, thanks. Meanwhile I learnt a bit more about LUA (it's pretty powerful!) and will happily use your code. I completely replace the normal roll. Will combine your code with a penalty system, i.e. with every press of the button it becomes less powerful (e.g. by decreasing the # of loops, or increasing the value storing fail) until it is a normal roller after a few presses. So a little fun factor remains...

    I besically want to get rid of the mouse button killing "1000 times rolling" :)

  • tortuosittortuosit Member Posts: 63
    edited December 2016
    How can I use code tags here?

    Lefreut, or anybody else... (it's WIP), this concept does not seem to enter the for loop which should take some time on this pc.., can you see why? It rolls instantly...

    function tort_autoRoll()
    -- Tortuosit
    if autoroll == 0 then
    local rolls = 15000
    local fails = 0.1
    elseif (autoroll == 1 and rolls > 10) then
    rolls = rolls - 10
    fails = fails + 0.1
    -- createCharScreen:OnAbilityStoreButtonClick()
    local best = chargen.totalRoll
    for i = 1,1500000 do
    if chargen.totalRoll > best and math.random() > fails then
    best = chargen.totalRoll
    autoroll = 1

  • tortuosittortuosit Member Posts: 63
    OK, I finished it. Meanwhile I found the debug mode :-)
    I ended up with an autoroller, which is initialized at entering the character reation. It allows for 7 to 20 roll clicks (where every click picks from 20 -decreasing- rolls), with a decreasing chance of good rolls. Then the button disappears. So some risk and fun is there, but still not unrealistically high rolls. Just time saving.
    It's here:

    Init is at CHARGEN menu, with:
    tort_autoroll = 0
    tort_fail = 0.05
    tort_rolls = 20"

  • lefreutlefreut Member Posts: 1,462
    edited November 2019

    Post edited by lefreut on
Sign In or Register to comment.