So i’ve just figured out this macro and decided to post it here since I can’t seem to find anything similar. It’s not the most well made and probably not the best way to do this since I’m quite mediocre at programming but it works fine so do tell me if there’s already something like this hehe.
It’s basically a macro that removes only removes the action bar keybinds and not for example the movement or interface keybinds.
Just thought it would be useful for when you’re figuring out new keybinds and don’t want to clear all keybinds or click unbind key for every binding :).
/run local x = {} local y = 0 for i = 31,124 do y = GetBindingKey(GetBinding(i)) if y ~= nil then table.insert(x, y) end end for i = 1, table.getn(x) do SetBinding(x[i]) end
And for anyone that cares how it works:
x is basically an array that will contain all the keybinds, y is a placeholder instead of writing GetBindingKey(GetBinding(i))
GetBinding(X)
returns the specified command for example if x = 1 then it returns the move and >steer command which you can see in the keybindings tab as it is the first >command.
/run print(GetBinding(1))
GetBindingKey(COMMAND)
returns the keybind of the specified command for example if you have bound W to move forward then type:
/run print(GetBindingKey(GetBinding(2)))
and it will print out the keybind for move forward.
SetBinding(KEY, COMMAND)
Sets the keybind KEY of the specified command COMMAND for example bind W to move forward:
/run SetBinding(“W”, GetBinding(2))
For this macro i used SetBinding without the Command parameter so it will instead unbind the command with the specified keybind KEY
for i = 31,124 do y = GetBindingKey(GetBinding(i))
After that it loops through commands 31 to 124 since that’s the range for only the action bar commands and then puts the keybind of the current command being checked in the placeholder.
if y ~= nil then table.insert(x, y)
Then it checks if the current command that’s being checked actually have a bind and adds it to the array:
table.insert(ARRAY, DATA)
for i = 1, table.getn(x) do SetBinding(x[i])
Then it loops through the keybinds array and removes all keybinds in the array.
I hope the explanation wasn’t too bad and as I said probably not the best way to go about this but does work so would be fun to see if people find it useful :).