WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Cladhaire's Mods (https://www.wowinterface.com/forums/forumdisplay.php?f=75)
-   -   Recover the target of one of Clique's actions (https://www.wowinterface.com/forums/showthread.php?t=15168)

Layrajha 03-05-08 04:29 PM

Recover the target of one of Clique's actions
 
Hello,

I've encountered a little issue with Clique. Well, it's probably more general than just Clique, but you may still be able to help me there.
Let's say that I have PoF bound with Clique. I'd like to announce things when about my target when I use PoF, so obviously, the best is to use a custom macro. However, the obvious "%t" for simple macros or "target" unidID for scripts is obviously not the target of the clique action, but my current target, which I do not care about the sightliest.
Question is:
Do I have an easy way to recover the unitID I need? Or at least the button I cliqued on (which is more or less equivalent)?

Thank you for your time (and for Clique ^^),

Layrajha

Cladhaire 03-06-08 02:04 AM

The mouseover unit is what you want.

Layrajha 03-06-08 04:00 AM

Wow, I wonder why I didn't think of that :) I expected something a bit complicated, and it's so simple :D
Thank you very much. I didn't realize that it's quite likely that my mouse is over a button when I click it :p:p

Though, just out of curiosity, if I used a macro to simulate the click (can't remember the syntax, but I'm pretty sure that there was a macro command to click on a UI button with a specific mouse button), mouseover would probably not work: would there be another option to make it work?

Cladhaire 03-06-08 04:04 AM

Nope, it can't just guess your target in that case. You could get the attribute programatically using ButtonName:GetAttribute("unit").

Layrajha 03-06-08 04:37 AM

Ok. Though, that's assuming that I know what button has been pressed (from the custom macro). I tried (because it was worth trying... maybe ^^) to see what "this" refers to, in a custom macro of Clique, and it is the Macro editbox. The odds for it to refer to the button were slim, but hey! What else ;)
I guess that some ugly modifications to Clique could give ways to do that (but I admit there is absolutely no interest :D).
Thank you again for your time.

Cladhaire 03-06-08 04:38 AM

It has nothing to do with Clique.. you need the Blizzard API to accomplish this very odd off-thing. Clique can't do anything for you.

Layrajha 03-06-08 06:27 AM

Quote:

Originally Posted by Cladhaire (Post 84673)
It has nothing to do with Clique.. you need the Blizzard API to accomplish this very odd off-thing. Clique can't do anything for you.

Well, I haven't investigated in Clique's code that much, and I may very well be wrong, but... if I really wanted to do this, and if I were allowed to code awful things, I think I could modify Clique so that the function that sets an attribute to a frame, when trying to assign the type "macro" and a given macrotext, would modify the given macrotext, replacing the occurrences of some kind of keyword (eg "clique_button") with the name of the frame (which is available through GetName() at this point of Clique's code, I think).

Again, no real interest in doing that, and again, I'm not sure if it's even possible, and if it is, there might be drawbacks that I haven't thought of (is there a size limit for the macrotexts given via SetAttribute, for instance?).

Cladhaire 03-06-08 06:33 AM

Quote:

Originally Posted by Layrajha (Post 84674)
Well, I haven't investigated in Clique's code that much, and I may very well be wrong, but... if I really wanted to do this, and if I were allowed to code awful things, I think I could modify Clique so that the function that sets an attribute to a frame, when trying to assign the type "macro" and a given macrotext, would modify the given macrotext, replacing the occurrences of some kind of keyword (eg "clique_button") with the name of the frame (which is available through GetName() at this point of Clique's code, I think).

Again, no real interest in doing that, and again, I'm not sure if it's even possible, and if it is, there might be drawbacks that I haven't thought of (is there a size limit for the macrotexts given via SetAttribute, for instance?).

If you are attempting to write a macro that clicks button A when you click-cast a specific combination on some other frame? If this is the case, you already know the name of the button.

Can you be extremely clear about how you want it to operate in a SPECIFIC case. Please don't tell me how you want to implement it, leave that up to me, but tell me how you want it to behave in a specific case. Then I might be able to give you something.

At the moment, I'm completely confused as to what you're hoping to accomplish.

Layrajha 03-06-08 06:44 AM

Ok :)

So, basically, let's say that I want to bind a macro to my "shift+leftclick", via Clique. This macro's text would be:
Code:

/cast Power Word: Shield
/run local button=clique_button; DEFAULT_CHAT_FRAME:AddMessage("I
shielded someone by clicking on " .. button:GetName() .. ", whose parent
is " ..button:GetParent():GetName() .. ".")

("clique_button" would be some keyword here, referring to the button I've clicked on)

Basically, it could output something like:
"I shielded someone by clicking on MyRaidAddon_Group3_Member2, whose parent is MyRaidAddon_Group3."

Again, I doubt there's any concrete use of that. But well... :)

Cladhaire 03-06-08 06:46 AM

Code:

/cast Power Word: Shield
/run local button = GetMouseFocus(); DEFAULT_CHAT_FRAME:AddMessage("I shielded someone by clicking on " .. button:GetName() .. ", whole parent is " .. button:GetParent():GetName() .. " .")


Layrajha 03-06-08 07:06 AM

Hmm, yes, but, but... it's the same as for "mouseover": it doesn't work if I bind the macro "/click MyRaidAddon_Group3_Member2" to my button "1", and if I press "1". I mean, my mouse could be anywhere on the screen.

Then, a way to know what unit I am casting on would be to know what button has been activated (by a "/click" command), and to use GetAttribute.

I really feel like I'm wasting your time with stupid questions though :< Maybe I should just quit ;)

Cladhaire 03-06-08 07:28 AM

Quote:

Originally Posted by Layrajha (Post 84678)
Hmm, yes, but, but... it's the same as for "mouseover": it doesn't work if I bind the macro "/click MyRaidAddon_Group3_Member2" to my button "1", and if I press "1". I mean, my mouse could be anywhere on the screen.

Then, a way to know what unit I am casting on would be to know what button has been activated (by a "/click" command), and to use GetAttribute.

I really feel like I'm wasting your time with stupid questions though :< Maybe I should just quit ;)

Well, no offense.. but you made the macro. you typed the name MyRaidAddOn_Group3_Member2. If this is the case, you know the button and can query it directly, and don't have to interface with Clique in any way.

Or am I missing something?

Layrajha 03-06-08 09:01 AM

Well... only that ideally, the macro that should know the name of the button is the one bound in Clique. My "/click" macro could have many conditionals to choose what button to click, after all, and assuming that I also want to trigger my message when I actually click on the button with my mouse (which means that I indeed show this message with a GetMouseFocus() or something), I could have situations where:
- My mouse is over Frame1
- I simulate a click on Frame2
=> I get a message about Frame1 and another message about Frame2, while nothing happened to Frame1

Cladhaire 03-06-08 10:19 AM

Quote:

Originally Posted by Layrajha (Post 84681)
Well... only that ideally, the macro that should know the name of the button is the one bound in Clique. My "/click" macro could have many conditionals to choose what button to click, after all, and assuming that I also want to trigger my message when I actually click on the button with my mouse (which means that I indeed show this message with a GetMouseFocus() or something), I could have situations where:
- My mouse is over Frame1
- I simulate a click on Frame2
=> I get a message about Frame1 and another message about Frame2, while nothing happened to Frame1

You're asking for way too much. These are things that are resolved at run-time by the SecureActionButton template. I promise, there is no voodoo that Clique can do, since its not choose the buttons at all.

Or I'm missing something, terribly. You keep saying things like "the button is the one bound in Clique".. and I don't know what that means.

Layrajha 03-06-08 10:21 AM

Bah, never mind, really :) There was really no point anyway.
Thanks again for your help and sorry about the digression.


All times are GMT -6. The time now is 11:27 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI