keyboard click events

  • God_Kra
    27th Aug 2016 Member 0 Permalink

    are there keyboard button click events?

  • jacob1
    27th Aug 2016 Developer 3 Permalink
    Yes. Here is the script I use to test them:

    function keyclicky(key, nkey, modifier, event)
        ---kmod = modifier%1024--ignore numlock and caps lock for now
        tpt.log(key, nkey, modifier, event)
    end

    tpt.register_keypress(keyclicky)


    event is 1 for keydown and 2 for keyup
    Edited once by jacob1. Last: 27th Aug 2016
  • God_Kra
    28th Aug 2016 Member 0 Permalink

    how do we check if someone pressed F11 key? also is there anyway to log something to the console?

    Edited 2 times by God_Kra. Last: 28th Aug 2016
  • jacob1
    28th Aug 2016 Developer 0 Permalink
    @God_Kra (View Post)
    Just run my script ...

    When I press f11, nkey is 292


    Also yes, use print() or tpt.log()
  • God_Kra
    29th Aug 2016 Member 0 Permalink

    i dont understand it.. could you explain? i never learned lua so..

  • jacob2
    29th Aug 2016 Member 0 Permalink
    @God_Kra (View Post)
    Then why are you creating a lua script? .-.

    Lua is pretty easy to learn, especially if you know another programming language.