Go to Page... |
Thread Tools | Display Modes |
08/14/14, 12:41 PM | #1 |
Disable key from standard ESO keystrip?
Is it possible to disable a key from the standard ESO gui's keystrip, so nothing happens if a user presses the key?
I'd like to react on something and after this disable the following keybindings: UI_SHORTCUT_PRIMARY -- Primary action/Accept UI_SHORTCUT_SECONDARY -- Secondary Action UI_SHORTCUT_TERTIARY -- Tertiary Action I've searched a while now and all I found is how you are able to change the texture, make them invisible, not mouse clickable (but they still work then, if someone presses the shortcut on his keybord/controller). With zgoo I found methods like SetKeybind() and SetKeybindEnabled() for controls. But they only seem to set the keybind to the control. I wasn't able to disable them with it. I also found a function you could use, if you stay out of combat: UnbindKeyFromAction protected (luaindex layerIndex, luaindex categoryIndex, luaindex actionIndex, luaindex bindingIndex) But I did not manage to get all needed parameters to unbind something. Maybe it's the wrong function too. And I would have to rebind the unbound keys afterwards again. Thanks for any help. Last edited by Baertram : 08/14/14 at 01:02 PM. |
|
08/14/14, 03:40 PM | #2 |
Did you try making a toplevel control and enable keyboard on it?
|
|
08/14/14, 04:05 PM | #3 |
I have not had any luck with this.
|
|
08/14/14, 04:48 PM | #4 |
Haven't tested this myself, but you could try something like this:
init: Code:
local keybindButtonDescriptor = KEYBIND_STRIP.keybinds["UI_SHORTCUT_PRIMARY"] local oldEnabled = keybindButtonDescriptor.enabled Code:
keybindButtonDescriptor.enabled = false -- can also be a function that returns a boolean KEYBIND_STRIP:UpdateKeybindButton(keybindButtonDescriptor) Code:
keybindButtonDescriptor.enabled = oldEnabled KEYBIND_STRIP:UpdateKeybindButton(keybindButtonDescriptor) Last edited by sirinsidiator : 08/14/14 at 04:51 PM. |
|
08/15/14, 08:15 AM | #5 | |
So you'll see the buttons on the keybind strip at the bottom, for example [E] and [R]. But No text next to it anymore. If you click them or press the key on your keayboard a lua error occurs: Code:
EsoUI/Libraries/ZO_KeybindStrip/ZO_KeybindStrip.lua:20: attempt to index a boolean value stack traceback: EsoUI/Libraries/ZO_KeybindStrip/ZO_KeybindStrip.lua:20: in function 'OnButtonClicked' EsoUI/Libraries/ZO_KeybindStrip/ZO_KeybindStrip.lua:234: in function 'ZO_KeybindStrip:TryHandlingKeybindDown' (tail call): ? (tail call): ? I'll try to play around with ZO_KeybindStrip_HandleKeybindDown ZO_KeybindStrip_HandleKeybindUp Last edited by Baertram : 08/15/14 at 08:35 AM. |
||
08/15/14, 11:57 AM | #6 |
After some experimenting I got a working example:
Code:
local button = nil TRADING_HOUSE_SCENE:RegisterCallback("StateChange", function() d("state change") zo_callLater(function() if(button) then return end button = KEYBIND_STRIP.keybinds["UI_SHORTCUT_TERTIARY"] local keybindButtonDescriptor = button.keybindButtonDescriptor local oldEnabled = keybindButtonDescriptor.enabled local oldCallback = keybindButtonDescriptor.callback d("disable") keybindButtonDescriptor.enabled = false keybindButtonDescriptor.callback = function() end KEYBIND_STRIP:UpdateKeybindButton(keybindButtonDescriptor) zo_callLater(function() d("enable") keybindButtonDescriptor.enabled = oldEnabled keybindButtonDescriptor.callback = oldCallback KEYBIND_STRIP:UpdateKeybindButton(keybindButtonDescriptor) end, 5000) end, 200) end) |
|
08/15/14, 12:02 PM | #7 |
I'm not sure if that would help you but I would do the following
Code:
ZO_PreHook(KEYBIND_STRIP, "TryHandlingKeybindDown", function(keybind) -- code which decides where you need to do something about keybind and return truwe which tells that you handled it and original function doesn't have to be called or return false or nil so it acts as normal end) |
|
02/01/15, 11:47 AM | #8 |
Just an update:
I got my wanted behaviour now by removing the item's context menu entries. If you remove the context menu entry the ralting keybind will be automatically removed too. I did this by pre-hooking the contexnt menu actions ZO_InventorySlotActions, function "AddSlotAction": Lua Code:
The function called: Lua Code:
If you return true the context-menu entry and the relating keybinding will be hidden. If you return false the context-menu entry and the relating keybinding will be shown/kept. If you just return (nil) nothing will be changed. Maybe the same as returning false. |
|
02/01/15, 07:58 PM | #9 | |
|
Just rewrite the keybindStripDescriptor for whatever window you want to change the keybindStrip buttons in. You don't need to hook anything, mess with context menus, or worry about "when" windows are opened or closed. Each time the window opens the keybindStripDescriptor gets automatically loaded into the keybindStrip control, so its all handled for you automatically. You can look at: TweakIt Example: STORE_WINDOW.keybindStripDescriptor (changing the keybindStrip for the store window) File: TweakIt/RepairIt/TweakIt_Repair.lua function: TweakIt.InitStoreKeybindStripDescriptors() function: local function GetRepairEquippedDescriptor() And you can see how I modified the keybindStripDescriptors for the store window to change the "Repair All" items to "Repair Equipped" items, which includes changing the callback to my own custom dialog box, but you could change it to do whatever you wanted...or remove the button completely. Let me know if you have any questions. Last edited by circonian : 02/01/15 at 11:13 PM. |
|
02/02/15, 01:53 AM | #10 |
This was an older thread and I just updated it with the info of my solution, if anybode wants to know about it.
Thanks for your inout as well circonian. In the meantime I learned about the keybind strips too ;-) My solution was the better one as the context menu entrys must be removed too (to secure items from beeing deconstructed e.g.) |
|
04/18/22, 02:25 AM | #11 |
|
for what it's worth....
more necro bounties :-)
might be useful to somebody else: I wanted to get rid of the "Sell all Junk" button in the store window... surprisingly just changing visibility was enough. Hitting the associated keybind "x" does nothing anymore.... Code:
local storekeybindstrip = STORE_WINDOW.keybindStripDescriptor for k,v in pairs(storekeybindstrip) do if type(v) == "table" and v["keybind"] == "UI_SHORTCUT_NEGATIVE" then STORE_WINDOW.keybindStripDescriptor[k]["visible"] = function() return false end end end Now to hunt down the inventory window keybindstrip to get rid of the "Destroy all junk" keybind if that one behaves differently I'll come back to update my post.. |
05/01/22, 09:11 AM | #12 | |
|
When following down data structures always ended up at some strange UserData values... google made me think this is where it all goes over into C coded functionality... But found a workaround, ESO calls a predefined Dialog upon pressing that button from ingame/globals/ingamedialogs.lua So I just overwrote that one in my code: Code:
ESO_Dialogs["DESTROY_ALL_JUNK"] = { title = { text = SI_PROMPT_TITLE_DESTROY_ITEMS, }, mainText = { text = "Functionality disabled by Addon",}, buttons = { [1] = { text = SI_DIALOG_DECLINE, },}, } |
|
ESOUI » Developer Discussions » General Authoring Discussion » Disable key from standard ESO keystrip? |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|