View Single Post
08/14/17, 03:56 AM   #4
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
You have dozens of addons which are very small and contains only 1 keybind.

To create a keybind :
  1. Add your Keybind definition file to your metafile (Keybinds should always be defined in last in mletafile)


    ex :

    Code:
    ## Title: MyAddon
    ## APIVersion: 100020
    ## Author: Me
    ## Description: Do something
    ## Version: 1
    
    MyAddon.lua
    Bindings.xml
  2. Create your keybind definition file it will link your Keybind to a function defined in your code. The function must be global (no "local keyword front of your function definition) :

    Code:
    <Bindings>
    	<Layer name="SI_KEYBINDINGS_LAYER_GENERAL">
    		<Category name="MyAddon">
    			<Action name="PUSH_THE_BUTTON">
    				<Down>MyAddon_SayHello()</Down>
    			</Action>
    		</Category>
    	</Layer>
    </Bindings>
  3. Link your function defiined in your .lua File ( MyAddon.lua ) and add the Binding string to the code

    Lua Code:
    1. ZO_CreateStringId("SI_BINDING_NAME_PUSH_THE_BUTTON", "Press to say hello")
    2.  
    3. function MyAddon_SayHello()
    4.     d("Hello")
    5. end
  4. Set your key and push the button

Last edited by Ayantir : 08/14/17 at 03:59 AM.
  Reply With Quote