Thomas_klei Posted January 13, 2019 Share Posted January 13, 2019 i know this is very stupid but is there a way for a function to repeat itself like if you read a book it will repeat the function . this is not for a specific character by the way Link to comment https://forums.kleientertainment.com/forums/topic/101733-need-help-coding/ Share on other sites More sharing options...
Norfeder Posted January 13, 2019 Share Posted January 13, 2019 (edited) local frequency = 30 -- 1 second inst:DoPeriodicTask(frequency * FRAMES, function() -- things to repeat end) This will repeat the task endlessly until you stop it. Edited January 13, 2019 by Norfeder Link to comment https://forums.kleientertainment.com/forums/topic/101733-need-help-coding/#findComment-1142652 Share on other sites More sharing options...
Thomas_klei Posted January 13, 2019 Author Share Posted January 13, 2019 thnx for helping it may be not what i needed specifically but this is a big leap from the ******* **** i can't make sorry for the swearing just back to school and i got to say i hate everything Link to comment https://forums.kleientertainment.com/forums/topic/101733-need-help-coding/#findComment-1142712 Share on other sites More sharing options...
CarlZalph Posted January 14, 2019 Share Posted January 14, 2019 (edited) local function StopBookTimer(inst_book) if inst_book.onreadtimer ~= nil then inst_book.onreadtimer:Cancel() inst_book.onreadtimer = nil end end local function OnReadTimerTick(inst_book) inst_book.onreadtimercounter = inst_book.onreadtimercounter + 1 -- Do whatever you want here if inst_book.onreadtimercounter == 4 -- 4 times to do this function before stopping it. then StopBookTimer(inst_book) end end local function OnRead(inst_book) StopBookTimer(inst_book) inst_book.onreadtimercount = 0 OnReadTimerTick(inst_book) -- Call it once immediately. inst_book.onreadtimer = inst_book:DoPeriodicTask( 3, -- Repeat every 3 seconds after waiting 3 seconds. OnReadTimerTick ) end Perhaps this may help you further. Edited January 14, 2019 by CarlZalph Link to comment https://forums.kleientertainment.com/forums/topic/101733-need-help-coding/#findComment-1143026 Share on other sites More sharing options...
Thomas_klei Posted January 16, 2019 Author Share Posted January 16, 2019 oh jeez thnx Link to comment https://forums.kleientertainment.com/forums/topic/101733-need-help-coding/#findComment-1143743 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now