ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Alpha/Beta AddOns (https://www.esoui.com/forums/forumdisplay.php?f=171)
-   -   My first addon, mute NPC ! (https://www.esoui.com/forums/showthread.php?t=863)

Etupa 04/13/14 08:19 PM

My first addon, mute NPC !
 
Hi, I spend many hours trying to figure out why keybindings doesn't work... they're available in setup but they doesn't work at all.

If anyone can help with this?

/mu and /un commands work well though... Still have to understand how to switch between 1 or 100 with the same command/keybind too. (I'm a true noob at this)


For bindings.xml
Code:

<Bindings>
  <Layer name="Addons">
    <Category name="Mute NPC">
      <Action name="MUTENPC">
                  <Down>mute()</Down>
        </Action>
                  <Action name="UNMUTENPC">
                <Down>unmu()</Down>
      </Action>
    </Category>
  </Layer>
</Bindings>

For Lua
Code:

MuteNPC = {}

local function Initialize( self, addOnName )
  if addOnName ~= "MuteNPC" then return end
end

ZO_CreateStringId("SI_BINDING_NAME_MUTENPC", "Mute Npc")
ZO_CreateStringId("SI_BINDING_NAME_UNMUTENPC", "Unmute Npc")

function mute()       
        local control = ZO_OptionsWindow.controlTable[2][9]
        SetSetting(control.system, control.settingId, 1)       
end


function unmu()       
        local control = ZO_OptionsWindow.controlTable[2][9]
        SetSetting(control.system, control.settingId, 100)       
end

SLASH_COMMANDS["/mu"] = mute
SLASH_COMMANDS["/un"] = unmu

EVENT_MANAGER:RegisterForEvent("MuteNPC", EVENT_ADD_ON_LOADED, Initialize )

txt
Code:

## Title: Mute NPC
## APIVersion: 100003
## Title: Etupa First


MuteNPC.lua
Bindings.xml


Etupa 04/14/14 04:04 AM

Ok done, thanks to Halja !

My problem was mainly my french client.


Code:

<Bindings>
  <Layer name="SI_KEYBINDINGS_LAYER_GENERAL">
    <Category name="SI_KEYBINDINGS_CATEGORY_USER_INTERFACE">
                <Action name="MUTENPC">
                  <Down>mute()</Down>
                </Action>
                <Action name="UNMUTENPC">
                        <Down>unmu()</Down>
                </Action>
    </Category>
  </Layer>
</Bindings>

Great, I share this now xD


All times are GMT -6. The time now is 09:18 AM.

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