vsz / Cooldown-Overlay

Tracks cooldown for each key press.
7 stars 3 forks source link

Left arrow triggers cooldown even though it is not mapped #10

Open Tschis opened 5 years ago

Tschis commented 5 years ago

As you can see I don't have any arrow mapped, but it still triggers red timer. image

krolikson commented 5 years ago

Strong ICE is on "4." That why.

krolikson commented 5 years ago

You using it on laptop right? It's problem with num navigation keys which are sticked in vk to arrow keys. I trying to find solution but it not easy :))

Tschis commented 5 years ago

Thanks for the reply! But I am not on laptop, on PC using a full size mechanical keyboard.

krolikson commented 5 years ago

I using tenless keyboard on my laptop. Anyone know how to remove vk sticky keys. Numpadup = 8 is sticky to arrow up, numpaddown = 2 sticky to arrow down, Numpadright = 6 arrow left and numpadleft = 4 sticky to arrow right. Python catching output from both keyboard i think, that why script trigger spells on arrow keys.

krolikson commented 5 years ago

I tried to suppress, remap and other thinks but it not help. Any solution?

krolikson commented 5 years ago

I was wrong about Python x64 library. Issue is in embbeded keys on keyboard which are installed with kB or Motherboard drivers, i, m not 100% sure which one of does two. For example: navi keys on numpad (numpad arrows) are sticky to "normal keys" ( numpad 8 is stick to numerical key "8" and to arrow key "UP" also in some kB layouts, have special signs like (', ", *, /, etc.) which are displayed when we Press key" 8" with some modifier like Shift, Alt etc. I think the problem is with Hook keyboardEvents when on PC we have running ACPI keyboardEvents(embbeded keys) like it is on laptop keyboard(fn keys) When we using keyboard Hook in Python we Hook all keyboard keys and keyboard events from Our OS (fn, special, sticky keys etc). If we Press, for example on laptop keyboard, key "4" - the input look like /'4', 'left', 'u', '$'/ We need to put some kind of filter (like it is in Windows) to catch only simple key(mayby scan_code? ), not "all keys and events" on pressed key. Off course it is few other ways to solve it. We can "flush" all sticky keys by redis (editing database by ~jupyter) or remove sticky key by "kbdedit" but you need to pay for this software. I found one more way to solve it. You just need to remap your numerical keys (2,4,6,8) but it isn't good solution :P On my laptop, now it's look like that: First key on my keyboard it ESC so: // ESC, F1, F2, F3, F4,F5,F6,F7,F8........ // ~ , 1, : , 3, $, 5, -, 7, #, 9, 0... // Q, W, E......... At this moment it is fastest and easiest solution. If i have some free time i Will make extra file with filter. Cheers :)

krolikson commented 5 years ago

Just add new file into cooldown-overlay folder by python. Name it arrow.py. Into cd-overlay.py you need write new line under "from classes import * " add import arrow. Save and run :)

import keyboard import time

def callback(state): print(state)

key = "up" key1 = "down" key2 = "left" key3 = "right"

upObject = keyboard.add_hotkey(key.upper(), callback, args=(),suppress=True,timeout=1,trigger_on_release=False) downObject = keyboard.add_hotkey(key.lower(), callback, args=(0,),suppress=True,timeout=1,trigger_on_release=False)

upObject = keyboard.add_hotkey(key1.upper(), callback, args=(),suppress=True,timeout=1,trigger_on_release=False) downObject = keyboard.add_hotkey(key1.lower(), callback, args=(0,),suppress=True,timeout=1,trigger_on_release=False)

upObject = keyboard.add_hotkey(key2.upper(), callback, args=(),suppress=True,timeout=1,trigger_on_release=False) downObject = keyboard.add_hotkey(key2.lower(), callback, args=(0,),suppress=True,timeout=1,trigger_on_release=False)

upObject = keyboard.add_hotkey(key3.upper(), callback, args=(),suppress=True,timeout=1,trigger_on_release=False) downObject = keyboard.add_hotkey(key3.lower(), callback, args=(0,),suppress=True,timeout=1,trigger_on_release=False)

upObject = keyboard.add_hotkey(key3.upper(), callback, args=(1,),suppress=True,timeout=1,trigger_on_release=False) downObject = keyboard.add_hotkey(key3.lower(), callback, args=(0,),suppress=True,timeout=1,trigger_on_release=False)

time.sleep(2) keyboard.remove_hotkey(upObject) keyboard.remove_hotkey(downObject)

krolikson commented 5 years ago

Arrows nevermore triggger spells which are assigned to digit's keys

eduardorost commented 9 months ago

I fixed this problem with this code.

def triggerByKey(self):
    #print(self.labelText + " triggered by Key")

    # pressed by arrow, skip becaus down arrow trigger hotkey 2
    if keyboard.is_pressed('up') or keyboard.is_pressed('down') or keyboard.is_pressed('left') or keyboard.is_pressed('right'):
        return

    if self.useType == UseType.TARGET:
        self.setTrigger()

    if self.useType == UseType.CROSSHAIR: 
        self.arm()

it seems working