Tabletop Simulator

Tabletop Simulator

Timer 2.0 - Scripted Countdown Tool
AJBruner77 2020 年 10 月 15 日 上午 12:38
Changing the timeCount, externally.
I really like this mod, but I have run into an issue. I need to be able to reset the timer to zero, and then add the correct time. Otherwise it just keeps adding time to whatever time was set before. How can I access the displayed time directly using a callback?
I tried using timer1.call("resetTimer"), but it does not reset the display to 0. Once the mod saves, it will only revert back to the value it was when it saved. If you start with 1 minute, start the mod and then reset, it will show 59 seconds.
< >
正在显示第 1 - 1 条,共 1 条留言
AJBruner77 2020 年 10 月 23 日 上午 10:33 
I figured a workaround for this. I removed the Save and Load data. Now when the timer is reset, it resets to the defaultStartTime. MrStump makes it super simple to edit any of their mods. Rarely have I needed to make too many alterations for the scope of my projects. Thanks for that!

Here is what I did. All of the Save function is commented out. I commented the Load function as well, just in case something broke it was an easy revert. This is what the Load function looks like:
function onload(saved_data) --if saved_data ~= nil and saved_data ~= "" then --local loaded_data = JSON.decode(saved_data) --timeCount = loaded_data.tc --timeMod = loaded_data.tm --else timeCount = 0 timeMod = 0 --end if timeCount > 0 then self.setColorTint(colorPause) end if defaultStartTime - timeCount + timeMod <= 0 then self.setColorTint(colorEnd) end runTimer = false disablePauseOrStart = false createButtons() end
最后由 AJBruner77 编辑于; 2020 年 10 月 23 日 上午 10:35
< >
正在显示第 1 - 1 条,共 1 条留言
每页显示数: 1530 50