Tabletop Simulator

Tabletop Simulator

Timer 2.0 - Scripted Countdown Tool
AJBruner77 15 Oct, 2020 @ 12:38am
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.
< >
Showing 1-1 of 1 comments
AJBruner77 23 Oct, 2020 @ 10:33am 
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
Last edited by AJBruner77; 23 Oct, 2020 @ 10:35am
< >
Showing 1-1 of 1 comments
Per page: 1530 50