Project Zomboid

Project Zomboid

110 ratings
Lua Timers
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
17.702 KB
15 Oct, 2022 @ 12:33am
8 Feb @ 1:24pm
4 Change Notes ( view )

Subscribe to download
Lua Timers

Description
THIS MOD IS API AND LITERALLY DON'T CHANGE ANYTHING

Explanation: https://pastebin.com/z3JmKBtL

Available functions:
timer:Simple(delay, function)
timer:Create(name, delay, repetitions, function)
timer:Remove(name)
timer:Exists(name)
timer:Start(name) - fully restarts (recreates) the timer
timer:Pause(name)
timer:UnPause(name)/timer:Resume(name)
timer:Toggle(name)
timer:TimeLeft(name)
timer:NextTimeLeft(name)
timer:RepsLeft(name)

Workshop ID: 2875394066
Mod ID: LuaTimers
27 Comments
𝚅𝚒𝚜𝚑𝚗𝚢𝚊  [author] 18 Dec, 2024 @ 12:03am 
@RJ_RayJay :steamthumbsup:
RJ_RayJay 17 Dec, 2024 @ 7:54am 
Hi @𝚅𝚒𝚜𝚑𝚗𝚢𝚊 I was wondering if I may have your permission to include a copy of Lua Timers as a library in a framework I'm making for Project Zomboid, let me know. Thanks!
RJ_RayJay 16 Feb, 2024 @ 2:04pm 
@𝚅𝚒𝚜𝚑𝚗𝚢𝚊 No problem, I'm glad it's fixed now (better late than never xD)
𝚅𝚒𝚜𝚑𝚗𝚢𝚊  [author] 16 Feb, 2024 @ 1:39pm 
@RJ_RayJay LOL, you right, I didn't upload it for for almost 2 years. how.. thanks for your notice about that, now it's correct :spiffo:
RJ_RayJay 16 Feb, 2024 @ 11:03am 
@𝚅𝚒𝚜𝚑𝚗𝚢𝚊 I don't see that in the files on my end for this mod, do you have an updated version?
Here's a picture of what I see: {LINK REMOVED}
𝚅𝚒𝚜𝚑𝚗𝚢𝚊  [author] 16 Feb, 2024 @ 5:38am 
@RJ_RayJay repetitions check only if `not v.Infinity` (line 58)
RJ_RayJay 15 Feb, 2024 @ 12:46pm 
@𝚅𝚒𝚜𝚑𝚗𝚢𝚊 Yes that's right, I set the repetitions to 0 to run the timer indefinitely but it would only run once in my testing. In your code at line 59 for lua_timers.lua it defines the following:

if v.Repetitions <= 0 then
timer.Timers[k] = nil
end

Since it checks if repetitions is less than or equal to 0, it will remove the timer.
𝚅𝚒𝚜𝚑𝚗𝚢𝚊  [author] 14 Feb, 2024 @ 3:42pm 
@RJ_RayJay `Infinity = repetitions == 0`
RJ_RayJay 14 Feb, 2024 @ 12:07pm 
I believe the infinite repetitions does not work. I checked your code and if the repetitions is less than or equal to 0 (which is what it should be for infinite reps) it will remove the timer. Unless I'm missing something in my analysis?
Lemonator 26 Jul, 2023 @ 6:09pm 
This is so fucking useful it saved me so much time with my mod.