View Single Post
04/13/14, 08:19 PM   #1
Etupa
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 8
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