JoystickGremlin
JoystickGremlin copied to clipboard
User plugin detect key to press with PhysicalInputVariable
I want to create a plugin where the user can specify the key that needs to be pressed
import time
import gremlin
from gremlin.user_plugin import *
key = PhysicalInputVariable(
"Key",
"Key example",
[gremlin.common.InputType.Keyboard]
)
It throws an error as it seems that it can't detect the guid form the keyboard. Is there something I'm missing?
Afterwards I want to use it on a macro like this:
key_macro = gremlin.macro.Macro()
key_macro.add_action(gremlin.macro.KeyAction(key.input_id, True))
But this triggers an error as the input_id is not valid for a key action Is there something I can do about this?
The PhysicalInputVariable
is not intended to be used with a keyboard but only with joysticks. The workaround would be to use the StringVariable
and use that key as the macro content.