How to add a keybind for existing addon?
There are couple of addons that disable spinning/zooming to character in menus. For example "no spin" or "no thank you" ...
How to add a keybind to that function? I know there must be a .xml file, but what exactly add to it? For example "no spin" addon has only this lines in its lua file: EVENT_MANAGER:RegisterForEvent("SpinStop", EVENT_ADD_ON_LOADED, function(eventCode, addon) if (addon):find("^ZO_") then return end for name, scene in pairs(SCENE_MANAGER.scenes) do if not (name):find("market") and scene:HasFragment(FRAME_PLAYER_FRAGMENT) then scene:RemoveFragment(FRAME_PLAYER_FRAGMENT) end end EVENT_MANAGER:UnregisterForEvent("SpinStop", eventCode) end) |
Take a look at my interaction addon, since it's small and has keybindings.
|
I´ve tried but with lua errors...
It must be a way to toggle spinning with a key... |
You have dozens of addons which are very small and contains only 1 keybind.
To create a keybind :
|
OK. I´ve already tried it. Could you help me with already existing lua file?:
EVENT_MANAGER:RegisterForEvent("SpinStop", EVENT_ADD_ON_LOADED, function(eventCode, addon) if (addon):find("^ZO_") then return end for name, scene in pairs(SCENE_MANAGER.scenes) do if not (name):find("market") and scene:HasFragment(FRAME_PLAYER_FRAGMENT) then scene:RemoveFragment(FRAME_PLAYER_FRAGMENT) end end EVENT_MANAGER:UnregisterForEvent("SpinStop", eventCode) end) How to bind this function to a keybind pls? |
It's not possible as it would need the addon to reload afterwards (after presisng the keybind).
The addon is removing whole fragments from scenes which will stay removed until you do a reloadui. So unfortunately this won't work by help of a keybind. You'd need to load/unload the addon and do a /reloadui afterwards. |
OK. I see.
Those are another lines from great addon "No thank you": local function DontRotateGameCamera() local emotesFragments = { FRAME_PLAYER_FRAGMENT, FRAME_EMOTE_FRAGMENT_INVENTORY, FRAME_EMOTE_FRAGMENT_SKILLS, FRAME_EMOTE_FRAGMENT_JOURNAL, FRAME_EMOTE_FRAGMENT_MAP, FRAME_EMOTE_FRAGMENT_SOCIAL, FRAME_EMOTE_FRAGMENT_AVA, FRAME_EMOTE_FRAGMENT_SYSTEM, FRAME_EMOTE_FRAGMENT_LOOT, FRAME_EMOTE_FRAGMENT_CHAMPION, } local blacklistedScenes = { market = false, crownCrateGamepad = true, crownCrateKeyboard = true, keyboard_housing_furniture_scene = true, gamepad_housing_furniture_scene = true, dyeStampConfirmationGamepad = true, dyeStampConfirmationKeyboard = true, } if SV.noCameraSpin then for name, scene in pairs(SCENE_MANAGER.scenes) do if not blacklistedScenes[name] then local sceneToSave = true for _, fragmentToRemove in ipairs(emotesFragments) do if scene:HasFragment(fragmentToRemove) then scene:RemoveFragment(fragmentToRemove) if sceneToSave then sceneToSave = false scenes[name] = scene scenes[name].toRestore = {} end table.insert(scenes[name].toRestore, fragmentToRemove) end end end end else for name, scene in pairs(scenes) do if scene.toRestore then for index, fragment in ipairs(scene.toRestore) do scene:AddFragment(fragment) end end end end end You can enable or disable camera zooming by clicking this option in settings. How about binding a key to this function? |
Use the post from Ayantir above to build a keybind for the function
"DontRotateGameCamera". Attention: The function is locally defined in the addon. You need to remove the local in fron of it so the keybindings is able to use it! Code:
local function DontRotateGameCamera() Code:
function DontRotateGameCamera() |
All times are GMT -6. The time now is 08:52 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI