"+" key is not working

  • #1, by dramaminiMonday, 27. October 2014, 15:08 6 years ago
    I've created a new action part for "+" key (under "Key actions" tab) but "+" key isn't working.

    Generaly these keys aren't working:

    Newbie

    44 Posts


  • #2, by afrlmeMonday, 27. October 2014, 15:19 6 years ago
    Did you hold down shift when you hit the plus key next to backspace key? I don't think numpad keys are supported. I've not tried using them before mind.

    The + key though when I accessed the key input via the new lua key input support I had to hold down shift before pressing the + key. Not sure if same in editor key actions.

    Imperator

    6842 Posts

  • #3, by dramaminiMonday, 27. October 2014, 15:28 6 years ago
    Yes, I tried to hold down shift, but nothing happend.
    Can I use "=" key via Lua?

    If this isn't possible, no problem, I'll use other keys instead of "-,+". (e.g "up arrow" and "down arrow")

    Newbie

    44 Posts

  • #4, by afrlmeMonday, 27. October 2014, 15:40 6 years ago
    sure you can use = or + via lua.

    function keyboard(eventType, character, keycode, modifiers)
    if eventType == eEvtKeyUp then -- key released
    if character == "r" then ... end
    elseif eEvtKeyTextInput then -- special keys (down/hold)
    if character == "+" then ... end
    if character == "-" then ... end
    end
    return false
    end

    registerEventHandler("keyEvent", "keyboard")
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12

    ... the only problem was that + key only works on keydown/hold & not key released for some reason. - works for either. keytextinput & keydown will continuously trigger every loop/frame until you release the key. I prefer to always use key released where possible. Also I'm not sure if arrow keys can be accessed via lua or not but you can access more keys than you can via the editor key actions.

    Here is a list of key events, codes & modifiers that David provided me with...
    // key events
    eEvtKeyUp
    eEvtKeyDown
    eEvtKeyTextInput

    // key modifiers
    eKeyModLShift
    eKeyModRShift
    eKeyModLCtrl
    eKeyModRCtrl
    eKeyModLAlt
    eKeyModRAlt
    eKeyModLGui
    eKeyModRGui
    eKeyModNum
    eKeyModCaps
    eKeyModMode
    eKeyModCtrl
    eKeyModShift
    eKeyModAlt
    eKeyModGui

    // key codes
    eKeyReturn
    eKeyEscape
    eKeyBackspace
    eKeyTab
    eKeySpace
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29

    Imperator

    6842 Posts

  • #5, by dramaminiMonday, 27. October 2014, 15:48 6 years ago
    Nice! Thank you very much!

    Newbie

    44 Posts

Write post