How can i make a simple sleep function with python, without freezing the metin client?
from time import sleep sleep(x)
Its not possible to set a time.sleep(delay) without crash or freezing?Quote:
I wouldn't advise on using the threading module. The game was desgined to be single thread, if you spawn another thread you might run into race conditions and thus get random crashes.
if app.GetTime() < timeyouwant:
code the part when the timer is running
else
after timer stopped
def SetSleepFunction(self, time):
self.function_sleep_time = app.GetGlobalTimeStamp() + time
def OnUpdate(self):
if self.function_sleep_time and self.function_sleep_time < app.GetGlobalTimeStamp():
self.function_sleep_time = None
# Your action