Jump to content


Photo

Access to key bindings through lua


    3 replies to this topic

    #1 Zerolimits

    Zerolimits

      Newbie

    • Members
    • Pip
    • 3 posts

      Posted 24 April 2015 - 12:51 AM

      Hey guys, I was wondering if keybinding information is available through lua? I want to make an addon that would allow me to type more easily into chat by disabling keybindings when the chat menu is opened. So if I had 'q' binded to 'dia' I could use 'q' to use dia when the chat is closed and type q in chat when it's opened without it being blocked by binding.

       

      Having the key binding information available would make creating this addon a lot easier. The other way to get keybinding information would be to use listbindings when the user opens the chat, parse which key binds are set from the game log, clear them temporarily and then restore them after the user is done chatting.



      #2 Arcon

      Arcon

        Advanced Member

      • Windower Staff
      • 1189 posts
      • LocationMunich, Germany

      Posted 24 April 2015 - 04:35 AM

      I'm not sure I see the point of this. You can use % to bind keys only when the chat log is closed and $ to bind only when they are open. For example:

      //bind %a echo foo
      //bind $a echo bar

       

      Now if you press a while the chat log is open it will print "bar", if you do it while the chat log is closed, it will print "foo".



      #3 Zerolimits

      Zerolimits

        Newbie

      • Members
      • Pip
      • 3 posts

        Posted 24 April 2015 - 02:59 PM

        I'm not sure I see the point of this. You can use % to bind keys only when the chat log is closed and $ to bind only when they are open. For example:

        //bind %a echo foo
        //bind $a echo bar

         

        Now if you press a while the chat log is open it will print "bar", if you do it while the chat log is closed, it will print "foo".

         

        This is exactly what I was looking for; don't know how I missed it xD. Thanks Arcon!



        #4 Zerolimits

        Zerolimits

          Newbie

        • Members
        • Pip
        • 3 posts

          Posted 24 April 2015 - 08:45 PM

          Here's what I came up with last night before seeing your response; I definitely prefer your one line approach ^^; I've commented it out pretty throughly to turn it into a demo of how to use some Windower events.

           

          https://github.com/M...r/bindnchat.lua

           

          Spoiler





          1 user(s) are reading this topic

          0 members, 1 guests, 0 anonymous users