Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2 > Metin2 Private Server
You last visited: Today at 21:12

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Delay between Python Code

Discussion on Delay between Python Code within the Metin2 Private Server forum part of the Metin2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2014
Posts: 35
Received Thanks: 1
Delay between Python Code

How can i make a simple sleep function with python, without freezing the metin client?
OnlyGood is offline  
Old 12/28/2022, 23:40   #2
 
.Daklyrus's Avatar
 
elite*gold: 0
Join Date: Mar 2016
Posts: 97
Received Thanks: 10
Does the following method make it freeze?

Code:
from time import sleep

sleep(x)
x = sleep time in seconds
.Daklyrus is offline  
Old 12/29/2022, 12:50   #3
 
elite*gold: 0
Join Date: Feb 2014
Posts: 35
Received Thanks: 1
Quote:
Originally Posted by .Daklyrus View Post
Does the following method make it freeze?

Code:
from time import sleep

sleep(x)
x = sleep time in seconds
yes, sleep makes it freeze
OnlyGood is offline  
Old 01/02/2023, 18:24   #4
 
elite*gold: 0
Join Date: Jun 2009
Posts: 70
Received Thanks: 151
My recommendation here is to create a new window, inherit from ui.ScriptWindow and then overwrite the OnUpdate method, this particular function will be run by the engine for every logic update cycle, you can leverage this to be used like a thread.
martinx1 is offline  
Thanks
1 User
Old 01/03/2023, 11:07   #5
 
Almanyo's Avatar
 
elite*gold: 0
Join Date: Sep 2022
Posts: 69
Received Thanks: 37
Either use a thread from threading module or use the mainloop of OnRender or OnUpdate like martinx1 said, but there you have to simulate the "sleep logic" by checking the current time(stamp).
Almanyo is offline  
Old 01/05/2023, 09:40   #6
 
Endless.'s Avatar
 
elite*gold: 0
Join Date: Apr 2010
Posts: 2,047
Received Thanks: 744
OnlyGood, try your function link with Thread
Endless. is offline  
Old 01/06/2023, 21:32   #7
 
elite*gold: 0
Join Date: Jun 2009
Posts: 70
Received Thanks: 151
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.
martinx1 is offline  
Old 01/10/2023, 17:10   #8
 
Endless.'s Avatar
 
elite*gold: 0
Join Date: Apr 2010
Posts: 2,047
Received Thanks: 744
Quote:
Originally Posted by martinx1 View Post
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.
Its not possible to set a time.sleep(delay) without crash or freezing?

then i can prefer only this solution:

Code:
if app.GetTime() < timeyouwant:
               code the part when the timer is running
else
            after timer stopped
or

Code:
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
Its from another Forum, because the most People have Problems with them.


Best Regards, Endless.
Endless. is offline  
Reply


Similar Threads Similar Threads
How is the time delay between walk packets being calculated?
03/18/2019 - Nostale - 8 Replies
Hello, did anyone figured out how delay between walk packets is calculated. My approximation is something like 920/4 * length of previous step, but it's not enough. Weird thing is that delay is varying even thought step length is not changing.
[Buying] EUW Account between between 10$ and 30$
08/27/2017 - League of Legends Trading - 3 Replies
The most important account to me : - Champions and skins number. OR - Gold / Plat if it has low champ and skins number Skype : TheThruthSoldiers Steam : Steam Community :: `Verd
SmartWHZ no delay is working i repeat No DELAY is Working!!!
09/17/2010 - Soldier Front Hacks, Bots, Cheats & Exploits - 61 Replies
dude i found out about the no delay that its working if u simply just turn it on ull get disconncted :( but theres a trick after turning it on turn it of right away there u are its working all ready but once u already turned it on and off u cant turn it off unless you log out :( its very usefull in horror mod pls press thnks
Remove Delay between scatters?
06/12/2009 - CO2 Programming - 3 Replies
I've been following and trying to learn about using olly and what not (Not to successful on the learning part) But, does anyone think there is a way to remove the delay between scatters back to how it was in old CO?
Delay between fights
05/09/2006 - Final Fantasy XI - 4 Replies
I just started playing, honestly, but this is pretty stupid that it takes me 30 seconds in between fights for no reason. If I kill a mob and move on with attempt to attack another I get the message, "You must wait longer to perform this action." Are there any hacks around to remove this delay? And even better, are there any hacks to keep me in battle mode so I don't sheath my weapons at the end of every fight like an idiot? Thanks.



All times are GMT +1. The time now is 21:12.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.