Thread Tools Display Modes
04/05/21, 11:38 PM   #1
IsJustaGhost
AddOn Author - Click to view addons
Join Date: May 2020
Posts: 37
Question unable to change/disable/capture reticle keybind

I'm looking for a way to actually disable the keybind for a specific interactable target.

I have tried everything I can think of.
I have created a keybind layer and self.interactKeybindButton:SetKeybind("UI_DISABLED", false, "UI_DISABLED"), but this only seems to remove the E/ A-button from being displayed.
Code:
		
<Action name="UI_DISABLED" hideAction="true" holdAndChordInteraction="RUN_ANYWAY">
	<Down>return false</Down>
	<Up>return false</Up>
</Action>

I have tried self.interactKeybindButton:SetEnabled(false) -- only grays out the keybind text
I have tried self.interactKeybindButton:SetKeybindEnabled(false)
I have tried self.interactKeybindButton.enabled = false,
I have tried self.interactKeybindButton:SetCallback(function() end), self.interactKeybindButton:SetCallback(nil)
I have tried self.interactKeybindButton = nil -- that just causes errors, but figured it was worth a shot
I have tried self.interactKeybindButton.OnClicked = nil -- does absolutely nothing
I've tried prehooking RETICLE.interactKeybindButton:OnClicked()

I've come to think this interactKeybindButton is only there for the text, not actual functionality.

The goal is to disable the possibility of interacting with a certain object while certain conditions are not met but, I need the target information to be displayed. This is why I cannot just simply hide the reticle for the target.

Being able to change the callback is also desired. This would be to store a timestamp that would be used to disable bypassing of the default function of the keybind until a determined time.
I have no issues with manipulating the different texts for the target,
  Reply With Quote
04/06/21, 08:57 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
I think there basically is no way to prevent the interaction. Most addons I know doing this kind of stuff hide the reticle but you'd still be able to use it.
The keybind code for that normally cannot be overwitten as it is local in teh ESOUI source code (or at least it was) and imo this is good :-) Else every 2nd addon would mess around with it and prevent anyone from turning in quests, etc.

But there are addons which prevent you from stealing items, like Dolgubons Lazy Writ Carfter (at turn in locaitons of writs -> steal items not allowed). Maybe check it's code how it is done there.
  Reply With Quote
04/06/21, 10:53 AM   #3
IsJustaGhost
AddOn Author - Click to view addons
Join Date: May 2020
Posts: 37
Thank you for suggesting to look at Dolgubons Lazy Writ Carfter. I would never have thought of the following.

This super simple code will disable the ability to interact with target if condition is met.

Code:
	
	local oldInteract = FISHING_MANAGER.StartInteraction
	local function hook(...)
		if self.disableInteract then -- condition to disable interaction
			return true
		else
			return oldInteract(...)
		end
	end

	FISHING_MANAGER.StartInteraction = hook
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » unable to change/disable/capture reticle keybind

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off