Thread Tools Display Modes
05-21-21, 02:13 PM   #1
phage
A Deviate Faerie Dragon
Join Date: Apr 2021
Posts: 15
Can someone write me a simple add-on?

This is something I actually already have in another add-on but I'd like to make it a standalone add-on. I can't figure it out how to steal it from the code so I'm hoping someone here can write it for me. This function needs to target an npc and then interact with them and I'd like to be able to bind the function to any key. Also, whenever the add-on is turned on, I want to be able to override whatever key I designate it to inside the code.

and yes, it is possible, see below.

https://streamable.com/pd8rpp
  Reply With Quote
05-21-21, 02:33 PM   #2
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
1. use a macro that contains /target npcname
2. bind "interact with target"

?
  Reply With Quote
05-21-21, 03:05 PM   #3
phage
A Deviate Faerie Dragon
Join Date: Apr 2021
Posts: 15
Originally Posted by sezz View Post
1. use a macro that contains /target npcname
2. bind "interact with target"

?
I want to have them bound to the same key and you can't do that with basic macros.
  Reply With Quote
05-21-21, 08:18 PM   #4
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
Originally Posted by phage View Post
I want to have them bound to the same key and you can't do that with basic macros.
Your current addon works with 1 single button press without using a lua unlocker on official servers?

Just curious, because InteractTarget and RunBinding are protected and I currently can't think of any other method to interact with a NPC, but maybe I'm missing something.
  Reply With Quote
05-22-21, 12:59 AM   #5
phage
A Deviate Faerie Dragon
Join Date: Apr 2021
Posts: 15
Originally Posted by sezz View Post
Your current addon works with 1 single button press without using a lua unlocker on official servers?

Just curious, because InteractTarget and RunBinding are protected and I currently can't think of any other method to interact with a NPC, but maybe I'm missing something.
What's a lua unlocker?
  Reply With Quote
05-21-21, 04:42 PM   #6
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
Originally Posted by phage View Post
This is something I actually already have in another add-on
It would be a hell of a lot easier if you actually shared that addon. It wouldn't make sense for anyone to "make" this addon when the code already exists and someone can just take it out.
  Reply With Quote
05-21-21, 05:00 PM   #7
phage
A Deviate Faerie Dragon
Join Date: Apr 2021
Posts: 15
Originally Posted by Kanegasi View Post
It would be a hell of a lot easier if you actually shared that addon. It wouldn't make sense for anyone to "make" this addon when the code already exists and someone can just take it out.
It's tied into too many functions for someone to easily remove. I didn't realize this was such an in-depth coding request.
  Reply With Quote
05-21-21, 05:20 PM   #8
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
Let others make that determination. Honestly, the fact that you can't write what you believe is "simple" is closely related to the fact that you can't extract this functionality from existing code.
  Reply With Quote
05-22-21, 11:58 AM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Your gif doesn't prove what you think it proves.

And you still haven't linked the addon you are currently using for this purpose.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
05-22-21, 12:13 PM   #10
phage
A Deviate Faerie Dragon
Join Date: Apr 2021
Posts: 15
Originally Posted by Seerah View Post
Your gif doesn't prove what you think it proves.

And you still haven't linked the addon you are currently using for this purpose.
I'm still not going to link my add-on as it's a private add-on and I don't want others to have access to it.
My gif shows I'm pressing a single keybind to perform each action, what do you mean?
  Reply With Quote
05-22-21, 06:26 PM   #11
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,364
Originally Posted by phage View Post
I'm still not going to link my add-on as it's a private add-on and I don't want others to have access to it.
My gif shows I'm pressing a single keybind to perform each action, what do you mean?
If the addon is NOT listed on a public addon site, how can anyone get access to it? If it IS listed on a public addon site, how can it be considered a "private addon"? As far as your GIF goes, it didn't tell me anything. Sorry.
__________________
Ahhhh, the vagueries of the aging mind. Wait.... What was I saying?


Carbonite <----- GitHub main module (Maps ONLY) download link. The other modules are also available on GitHub.
Carbonite-CLASSIC<----- GitHub link to Carbonite Classic. Thanks to ircdirk for this!
  Reply With Quote
05-22-21, 07:38 PM   #12
phage
A Deviate Faerie Dragon
Join Date: Apr 2021
Posts: 15
Originally Posted by jeffy162 View Post
If the addon is NOT listed on a public addon site, how can anyone get access to it? If it IS listed on a public addon site, how can it be considered a "private addon"? As far as your GIF goes, it didn't tell me anything. Sorry.
If I shared it here, it wouldn't be private.

Anyways, here's the section of the code that handles the one-button target and interact with function. I'm not really sure why you're all saying this is impossible.

I removed a few lines as they're irrelevant to the process.

Code:
local addonName = ...
ezopen_keybind = 'SPACE'
 
function EzOpenMixin:OnEvent(e, ...)
        CreateFrame("Button", "setButton", UIParent, "SecureActionButtonTemplate")
        setButton:SetAttribute("type", "macro")
        setButton:SetAttribute("macrotext", "/run SetOverrideBinding(\""..ezopen_keybind.."\", 'INTERACTTARGET')\n/target NPC NAME HERE")
        setButton:RegisterForClicks("AnyUp", "AnyDown")
        SetOverrideBindingClick(self, false, ezopen_keybind, 'setButton')
    elseif e == "AUCTION_HOUSE_SHOW" then
        SetOverrideBindingClick(self, false, ezopen_keybind, 'setButton')
    elseif e == "AUCTION_HOUSE_CLOSED" then
        -- ClearOverrideBindings(self)
    elseif e == "AUCTION_HOUSE_THROTTLED_MESSAGE_RESPONSE_RECEIVED" then
        C_Timer.After(0.1, function() self.isReady = true end)
    elseif e == "AUCTION_HOUSE_THROTTLED_MESSAGE_SENT" then
        self.isReady = false
    end
end
  Reply With Quote
05-24-21, 03:20 PM   #13
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
Originally Posted by phage View Post
Anyways, here's the section of the code that handles the one-button target and interact with function. I'm not really sure why you're all saying this is impossible.
Well, because it's 2 button presses - I specifically asked if it's only 1 single key press.
Nevertheless, I'm glad you found it though Do you still need help with removing everything that's unrelated to targetting and interacting?
  Reply With Quote
05-22-21, 12:49 PM   #14
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
There's an "Interact With Mouseover" keybind under "Targeting".

Edit: It's available to all clients, retail, classic, and BCC.
Attached Thumbnails
Click image for larger version

Name:	Interact-With-Mouseover.png
Views:	220
Size:	515.3 KB
ID:	9636  
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 05-22-21 at 12:57 PM.
  Reply With Quote
05-25-21, 12:05 PM   #15
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Ah, yes. That is indeed 2 button presses, not one. So long as they are not protected functions, you can do

Code:
if condition1 then
   do first thing
elseif condition2 then
   do other thing
else
   do third thing
end
(Though the code you linked is for an event handler, not button presses.)
(Oh, and we can't actually see button presses in a gif. )
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh


Last edited by Seerah : 05-25-21 at 12:08 PM.
  Reply With Quote
05-26-21, 09:32 AM   #16
Soyier
A Deviate Faerie Dragon
 
Soyier's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2015
Posts: 10
I have a Teaching Addon repo that I use for this very purpose. It's a fully stubbed out repo, and all you have to do is fill in the blanks so to speak.

https://github.com/brittyazel/TeachingAddon

It may be helpful
  Reply With Quote
01-13-22, 10:34 AM   #17
markc1999
A Defias Bandit
 
markc1999's Avatar
Join Date: Oct 2007
Posts: 2
I was looking for this too, and had been trying to get RunBinding("INTERACTTARGET"[, "up"]) to work
At least in Classic, where does it say this is Protected?
https://vanilla-wow-archive.fandom.c...ding_Functions
says "PROTECTED" before api commands that are protected, and this doesnt have that?
https://wowwiki-archive.fandom.com/wiki/API_RunBinding same thing
  Reply With Quote
01-16-22, 04:15 PM   #18
DahkCeles
A Cliff Giant
 
DahkCeles's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2020
Posts: 73
You are looking at archived wikis from long ago. The community has consolidated on Wowpedia.

https://wowpedia.fandom.com/wiki/Wor...I#Key_Bindings
  Reply With Quote
01-16-22, 09:34 PM   #19
Mastalock
A Defias Bandit
Join Date: Jan 2022
Posts: 2
Wierd... it was saying I could not reply? I had to make a new account
Not sure why.. doesnt make any sense and had no notices in mail/here

Anyway, reguardless of which of those many sites.. why do none of them (including the one u linked) have the PROTECTED flag?
  Reply With Quote
01-17-22, 10:31 AM   #20
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,359
The detail page for RunBinding has that info
RunBinding cannot be used to call a Protected Function from insecure execution paths.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Can someone write me a simple add-on?

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