|
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
|
02-08-2008 07:01
I'm developing a script for a sword. Using default Mellee weapon script.
When someone press LMB the WASD keys are blocked so the avatar doesn't rotate when making a hit. When someone unhold LMB those controls are restored normally.
Due to a lag issue conrols event sometimes does not detect that avatar released LMB so it can use WASD keys.
What should be the best way to resolve this?
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
02-08-2008 10:01
I don't know that script, but I'd be real suspicious of anything the script does with CONTROL_LBUTTON on the premise that "lag" is really the script processing the last LMB event forever, or falling so far behind the event stream that the trailing edge of LMB down never makes it into the buffer at all (the queue is only 64 deep).
I suppose if there's just no way to streamline the LMB processing code, one could rig a timer that expired some short interval after an LMB event and cleared at the trailing edge; if the timer ever expired, the script then should do whatever it does on the trailing edge in order to revert to normal processing of movement keys.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
02-08-2008 10:01
Maybe test the state of the mouse button when you handle each of the directional controls? Or are you grabbing/releasing the other controls based on the button input? In that case, I'd make sure it isn't a defect in your script and then file a defect in JIRA. You shouldn't be missing control events. There's no way to test the state of the keys without them, so they HAVE to come through intact.
Another possibility though: for the directional controls, you should get control events periodically while the key is held down. If the same is true for the mouse button (you should test this), you could set a timer on each control event, and assume the mouse button is released if you don't get another control event before the timer event triggers.
|