dudeim
New Member
- Reaction score
- 22
Hey,
first of all sorry for the bad title couldn't think of a good one.
Ok so I have a problem in my code I have a struct in which a function is ran every x seconds (user can input the x themselfs) now I want to add a check every time that function runs so it can either not go off or it can.
I had this but it's not working as I need to be able to input the condition anytime.
So if I do this it should work:
So how would I go and do this?
Hope I made myself clear
Thanks!
first of all sorry for the bad title couldn't think of a good one.
Ok so I have a problem in my code I have a struct in which a function is ran every x seconds (user can input the x themselfs) now I want to add a check every time that function runs so it can either not go off or it can.
JASS:
I had this but it's not working as I need to be able to input the condition anytime.
So if I do this it should work:
JASS:
function something ....
local Struct s = Struct.create(interval 5, totaltime 20, somefunctionthatwillberan) //this will run for a total of 20 sec and the function that will go off will run every 5 seconds
call s.addCondition(function somefunctionwhichreturnsabooleanvalue) //now it checks everytime if this value is true
call TSA(10)
call s.addCondition(function someotherfunctionwhichreturnsanotherbooleandifferentfromthefirst) //now it checks if this value is true
endfunction
So how would I go and do this?
Hope I made myself clear
Thanks!