31.08.2016, 12:38
Hey! I was scripting a keybind script, where I ran into an issue with key binds.
So what I'm doing is to compare 2 different key masks and see if the key combinations are pressed.
This is what I tried to do:
But the problem for that was, any key that's in keymask 2 would pass. That works just fine for a single key bind, but if I require a combination, any of the keys would pass. I know I could do this:
But in that case, the bind wouldn't get called if any other buttons are pressed down.
Do I really have to use a loop to achieve this functionality or is there a better way?
Thanks in advance.
Currently I'm looping through the keys and checking them against keymask2 and then newkeys, if any of them fail, I break the loop. That currently seems the only working option to me, but rather inefficient.
So what I'm doing is to compare 2 different key masks and see if the key combinations are pressed.
This is what I tried to do:
Код:
if(newkeys & keymask2)
Код:
if(newkeys == keymask2)
Do I really have to use a loop to achieve this functionality or is there a better way?
Thanks in advance.
Currently I'm looping through the keys and checking them against keymask2 and then newkeys, if any of them fail, I break the loop. That currently seems the only working option to me, but rather inefficient.