2021-08-28

efficient function & variable that builds up to it's value over (x) time. Logitech's GHUB

I write lots of lua code for games in logitech's GHUB. I am looking for support.

the numbers and "variables" have been changed for the purpose of easier reading.


Let's say variable2 and variable3 both = 10 and 12, respectively.

Let's say the sleep variable4 and variable5 = 5 and 7, respectively.


I want the most efficient way variable2 and variable3 can start with a value of 1 the first time, then upon repeating, it moves up to 2, and 3, all the way to its desired value. When it reaches its value, I want it to stay at that value.

I also want Variable4 and Variable5 to go from a value of 10, to 9, 8, then down to 5 eventually.

Thanks in advance. Im a novice that can take a code that doesnt match mine and insert it, so don't feel you need to hand hold. But im clearly no expert so dont hurt my thin feelings. Thanks a bunch.

function StackOverflow()
    if ACTION(1) then 
             repeat                 
                     ACTION(555,math.random(VARIABLE2,VARIABLE3))
                     Sleep(math.random(VARIABLE4,VARIABLE5))
             until not REPEATFUNCTIONCOMPLETE(1)
         end
        end

 

 
function OnEvent(event,arg)
 if  DoStuff(1)then
            if ACTION(1) then 
                repeat 
                    if ACTION2(2)then
                            StackOverflow()  
                        else
                                Sleep(2)
                        end
                 until not REPEAT(1)
                end
end
end


from Recent Questions - Stack Overflow https://ift.tt/3DnYxLR
https://ift.tt/eA8V8J

No comments:

Post a Comment