Search the Community

Showing results for tags 'timing'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Oxygen Not Included
    • Oxygen Not Included FAQ
    • [Oxygen Not Included] - Developer log
    • [Oxygen Not Included] - General Discussion
    • [Oxygen Not Included] - Mods and Tools
    • [Oxygen Not Included] - Suggestions and Feedback
    • [Oxygen Not Included] - Bug Tracker
    • [Oxygen Not Included] Art, Music & Lore
    • Community Challenges
    • [Oxygen Not Included] - Latest Content Update
    • [Oxygen Not Included] - Latest Animated Short
  • Don't Starve Together
    • Don't Starve Together FAQ
    • [Don't Starve Together] Developer log
    • [Don't Starve Together] General Discussion
    • [Don't Starve Together] Return of Them
    • [Don't Starve Together] PS4
    • [Don't Starve Together] Xbox One
    • [Don't Starve Together] Bug Tracker
    • [Don't Starve Together] Trading
    • [Don't Starve Together] Server Bulletin
    • [Don't Starve Together] Dedicated Server Discussion
    • [Don't Starve Together] Mods and Tools
    • [Don't Starve Together] Tales of Life and Death
    • [Don't Starve Together] Suggestions and Feedback
    • [Don't Starve Together] The Forge
    • [Don't Starve Together] The Gorge
    • [Archived Bugs]
  • Hot Lava
    • [Hot Lava Beta] - General Discussion
    • [Hot Lava Beta] - Suggestions and Feedback
    • [Hot Lava Beta] - Bug Tracker
    • [Hot Lava Beta] - Strats and Records
    • [Hot Lava Beta] - Developer Log
    • Hot Lava Beta Latest Update
  • Griftlands
    • [Griftlands] - General Discussion
  • Don't Starve
    • Don't Starve FAQ
    • [Don't Starve: Pocket Edition] iOS / Android
    • [Don't Starve] General Discussion
    • [Don't Starve] Mods and tools
    • [Don't Starve] Art, Music & Lore
    • [Don't Starve] Suggestions and Feedback
    • [Don't Starve] Videos
    • [Don't Starve] Bug Tracker
    • [Don't Starve] Trading
    • [Don't Starve] Testing Discussion (archive)
  • Klei Entertainment Games
    • Eets Munchies
    • [Invisible, Inc.] General Discussion and Strategies
    • Mark of the Ninja
    • Shank
  • Other Stuff
    • The Off-Topic Area
    • Forum Upgrade

Categories

  • Don't Starve
    • Custom Character and Skins
    • Game Modifications
    • Language Packs
    • Modding Tools, Tutorials & Examples
    • Custom Maps

Categories

  • Oxygen Not Included - [Early Access]
  • Don't Starve: Hamlet
  • Don't Starve: Hamlet Early Access
  • Don't Starve Together
  • Don't Starve Together: Return of Them
  • Don't Starve Together: The Gorge
  • Don't Starve Together: The Forge
  • Don't Starve Together: The Forge (Archive)
  • [Don't Starve Together] PS4
  • [Don't Starve Together] Xbox One
  • Don't Starve: Shipwrecked
  • Don't Starve: Shipwrecked [archive]
  • [Don't Starve Together] PS4 (archive)
  • [iOS] Don't Starve: Shipwrecked
  • Don't Starve: Hamlet Closed Beta (ARCHIVE)

Categories

  • Oxygen Not Included - [Early Access]
  • Don't Starve: Hamlet
  • Don't Starve Together
  • [PS4] Don't Starve Together
  • [Xbox One] Don't Starve Together
  • Don't Starve: Shipwrecked
  • Hot Lava - [Open Beta]

Categories

  • Hot Lava - Beta Reports


Biography


Location


Interests


Occupation


Modder


Chester Kickstarter


Chester Kickstarter


Chester Kickstarter


Chester Kickstarter


Chester Kickstarter


Klei Featured Artist


Early Supporter


Early Supporter


Don't Starve


Don't Starve Together


Oxygen Not Included

Found 1 result

  1. I have two different components that I activate one after the other. One uses DoTaskInTime to schedule a task for 30 seconds from now. The other uses DoPeriodicTask to schedule a task to run every 0.1 seconds over a total of 30 seconds. For some reason, the second task finishes all its iterations in 20 seconds instead of 30 like the first one. The periodic task increases a number value in every iteration, from 0 to 1, in increments of 0.1 / 30. When it reaches 1 it stops. This should take 300 iterations, so with an interval of 0.1 it should take 30 seconds in total. Even if the calculations in my code are wrong, it doesn't change the fact that the periodic task occurs too quickly. I put debug printouts right before starting the periodic task, printing the interval, and in the tick function printing the progress. The server log shows 15 prints per second, 1.5 times faster than it should be (which corresponds to the total time being 2/3 of what it should be). If I increase the interval to 0.5 the total time for the periodic task increases to about 27 seconds. I really have no idea what's going on here and how to fix it. Here's the code for the component (not much here, really): -- Fake component for enabling usage of the recharge -- item slot animation from The Forge local Rechargeable = Class(function(self, inst) self.inst = inst self.percent = 1 self.recharge_time = 0 self.interval = 0 end) local function do_recharge(inst, self) self:SetPercent(math.min(1, self:GetPercent() + self.interval / self:GetRechargeTime())) print("[Mod] Percentage: " .. tostring(self:GetPercent())) if self:GetPercent() == 1 then self:StopRecharging() end end function Rechargeable:GetPercent() return self.percent end function Rechargeable:GetRechargeTime() return self.recharge_time end function Rechargeable:SetPercent(percent) self.percent = percent self.inst:PushEvent("rechargechange", { percent = self.percent }) end function Rechargeable:SetInterval(interval) self.interval = interval end function Rechargeable:SetRechargeTime(recharge_time) self.recharge_time = recharge_time self.inst:PushEvent("rechargetimechange", { t = self.recharge_time }) end function Rechargeable:StartRecharging(starting_percentage) if starting_percentage then self:SetPercent(starting_percentage) end print("[Mod] Starting percentage: " .. tostring(self:GetPercent()) .. " ; Inteval: " .. tostring(self.interval)) if self.recharge_task == nil then self.recharge_task = self.inst:DoPeriodicTask(self.interval, do_recharge, nil, self) end end function Rechargeable:StopRecharging() if self.recharge_task ~= nil then self.recharge_task:Cancel() self.recharge_task = nil end end return Rechargeable And here is the relevant debug output: Like I said, 15 prints per second. What's the problem here and how do I make DoPeriodicTask work like I expect? I would have suspected server load but it's working faster than it should. Thanks in advance.