JoystickGremlin icon indicating copy to clipboard operation
JoystickGremlin copied to clipboard

User plugin detect key to press with PhysicalInputVariable

Open gavazquez opened this issue 2 years ago • 1 comments

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?

image

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?

gavazquez avatar Aug 20 '22 17:08 gavazquez

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.

WhiteMagic avatar Aug 20 '22 17:08 WhiteMagic