44 lines
No EOL
1 KiB
Lua
Executable file
44 lines
No EOL
1 KiB
Lua
Executable file
local function unsetBinding(action)
|
|
local key1, key2 = GetBindingKey(action);
|
|
if key1 then
|
|
SetBinding(key1, nil);
|
|
end
|
|
if key2 then
|
|
SetBinding(key2, nil);
|
|
end
|
|
end
|
|
|
|
local function setBindingRM(key, action)
|
|
unsetBinding(action);
|
|
if SetBinding(key, action) then
|
|
print("Set binding " .. key .. " to " .. action);
|
|
else
|
|
print("Failed to set binding " .. key .. " to " .. action);
|
|
end
|
|
SaveBindings(1);
|
|
end
|
|
|
|
-- https://wowpedia.fandom.com/wiki/BindingID
|
|
local myBinds = {
|
|
["1"] = "ACTIONBUTTON1",
|
|
["2"] = "ACTIONBUTTON2",
|
|
["3"] = "ACTIONBUTTON3",
|
|
}
|
|
|
|
local function setAllBinds()
|
|
setBindingRM("CTRL-2", "ACTIONBUTTON1");
|
|
setBindingRM("1", "ACTIONBUTTON2");
|
|
print("Bindings set")
|
|
end
|
|
|
|
-- Define a function to handle the /hello command
|
|
local function HelloCommandHandler(msg, editbox)
|
|
setAllBinds()
|
|
end
|
|
|
|
-- message('loaded')
|
|
print("test")
|
|
|
|
-- Register the /hello command
|
|
SLASH_BINDS1 = "/binds"
|
|
SlashCmdList["BINDS"] = HelloCommandHandler |