Project Zomboid

Project Zomboid

112 个评价
Lua Timers
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
更新日期
17.702 KB
2022 年 10 月 15 日 上午 12:33
2 月 8 日 下午 1:24
4 项改动说明 ( 查看 )

订阅以下载
Lua Timers

描述
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
29 条留言
𝚅𝚒𝚜𝚑𝚗𝚢𝚊  [作者] 9 月 16 日 上午 12:36 
@듀파 sure, no problem
듀파 9 月 13 日 上午 7:19 
Can i get permission to add this to a mod so that i dont require it to minimize the dependencies . If its ok. I wil also give you credit.
𝚅𝚒𝚜𝚑𝚗𝚢𝚊  [作者] 2024 年 12 月 18 日 上午 12:03 
@RJ_RayJay :steamthumbsup:
RJ_RayJay 2024 年 12 月 17 日 上午 7:54 
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 2024 年 2 月 16 日 下午 2:04 
@𝚅𝚒𝚜𝚑𝚗𝚢𝚊 No problem, I'm glad it's fixed now (better late than never xD)
𝚅𝚒𝚜𝚑𝚗𝚢𝚊  [作者] 2024 年 2 月 16 日 下午 1:39 
@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 2024 年 2 月 16 日 上午 11:03 
@𝚅𝚒𝚜𝚑𝚗𝚢𝚊 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: {链接已删除}
𝚅𝚒𝚜𝚑𝚗𝚢𝚊  [作者] 2024 年 2 月 16 日 上午 5:38 
@RJ_RayJay repetitions check only if `not v.Infinity` (line 58)
RJ_RayJay 2024 年 2 月 15 日 下午 12:46 
@𝚅𝚒𝚜𝚑𝚗𝚢𝚊 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.
𝚅𝚒𝚜𝚑𝚗𝚢𝚊  [作者] 2024 年 2 月 14 日 下午 3:42 
@RJ_RayJay `Infinity = repetitions == 0`