Heya, propably this is a pretty noobish question, but how can I delay the execution of a command?
Thank you
kami
Delays
Heres one method, using python:
http://www.sourcepython.com/forums/showthread.php?143-GSRPG-(German-Slaughterhouse-RPG)-NOT-RELEASED-COMING-SOON&p=643&viewfull=1#post643
http://www.sourcepython.com/forums/showthread.php?143-GSRPG-(German-Slaughterhouse-RPG)-NOT-RELEASED-COMING-SOON&p=643&viewfull=1#post643
-Tuck
Thank you for the answer :)
I have this line:
But it gives me this error:
I have this line:
Syntax: Select all
prot_delay = Timer(10.0, entity.SetPropInt("CBaseAnimating.m_nHitboxSet", 0))
prot_delay.start()
But it gives me this error:
Thats because your using it the wrong way :)
Try this:
Try this:
Syntax: Select all
prot_delay = Timer(10.0, entity.SetPropInt, ["CBaseAnimating.m_nHitboxSet", 0])
prot_delay.start()
-Tuck
You are executing the code directly instead of passing arguments.
Instead of:
Use:Satoon
Instead of:
Syntax: Select all
prot_delay = Timer(10.0, entity.SetPropInt("CBaseAnimating.m_nHitboxSet", 0))
Use:
Syntax: Select all
prot_delay = Timer(10.0, entity.SetPropInt, ("CBaseAnimating.m_nHitboxSet", 0))
satoon101 i used [] because u wouldnt get strange problems using it that way, If people come back here to see what to do
(not saying your wrong just making sure people would notice the difference) :)
would give this error for function that only accepts one argument
(not saying your wrong just making sure people would notice the difference) :)
Syntax: Select all
Timer(10.0, FUNCTION, ("CBaseAnimating.m_nHitboxSet"))
would give this error for function that only accepts one argument
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python33\lib\threading.py", line 639, in _bootstrap_inner
self.run()
File "C:\Python33\lib\threading.py", line 825, in run
self.function(*self.args, **self.kwargs)
TypeError: FUNCTION() takes 1 positional argument but 27 were given
-Tuck
Well:This is not a tuple:So, you are basically passing a string, when you should be passing an iterable.
To make it a tuple, use the following:You can also use a list, as you have, but that really is not the proper way to do it.
Satoon
Syntax: Select all
("CBaseAnimating.m_nHitboxSet")
Syntax: Select all
>>> type(("CBaseAnimating.m_nHitboxSet"))
<class 'str'>
>>> type(("CBaseAnimating.m_nHitboxSet", ))
<class 'tuple'>
To make it a tuple, use the following:
Syntax: Select all
("CBaseAnimating.m_nHitboxSet", )
Satoon
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 45 guests