ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   AddOn Help/Support (https://www.esoui.com/forums/forumdisplay.php?f=164)
-   -   If key is down? (https://www.esoui.com/forums/showthread.php?t=529)

FoleyX90 04/03/14 11:23 AM

If key is down?
 
I see in the documentation to set events for keyup / keydown but what I'm trying to do is simply check
if Key.IsDown(KEY_F)
or something similar. Does anybody know if this is possible? I don't want to have to create a new bind option because the key I'll be using is also used for other things and the context of it makes sense in this scenario (secondary interaction)

vapakule 04/09/14 02:53 PM

Hi FoleyX90,
i have only one solution, regarding this example on wiki
http://wiki.esoui.com/AddOn_Quick_Qu...an_tie_into.3F

bindings.xml
Lua Code:
  1. <Bindings>
  2.   <Layer name="SI_LAYER_NAME_STRING">
  3.     <Category name="SI_CATEGORY_NAME_STRING">
  4.       <Action name="TURN_RIGHT">
  5.         <Down>OnKeyDown()</Down>
  6.         <Up>OnKeyUp()</Up>
  7.       </Action>
  8.     </Category>
  9.   </Layer>
  10. </Bindings>
This creates a section in the ESC->Controls->Keybindings settings where you need to bind keys, before you can trigger key up/down events.

lua:
Lua Code:
  1. ZO_CreateStringId("SI_BINDING_NAME_TURN_RIGHT", "Turn Right")
After that you can call any func you whant

Lua Code:
  1. function MyAddnon.OnKeyDown()
  2.   --do somtehing
  3. end
  4. function MyAddnon.OnKeyUp()
  5.   --do somtehing
  6. end

i hope it will help,Good luck!


All times are GMT -6. The time now is 08:30 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI