Thread Tools Display Modes
03-05-08, 04:29 PM   #1
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
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
  Reply With Quote
03-06-08, 02:04 AM   #2
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
The mouseover unit is what you want.
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."
  Reply With Quote
03-06-08, 04:00 AM   #3
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Wow, I wonder why I didn't think of that I expected something a bit complicated, and it's so simple
Thank you very much. I didn't realize that it's quite likely that my mouse is over a button when I click it

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?
  Reply With Quote
03-06-08, 04:04 AM   #4
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
Nope, it can't just guess your target in that case. You could get the attribute programatically using ButtonName:GetAttribute("unit").
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."
  Reply With Quote
03-06-08, 04:37 AM   #5
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
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 ).
Thank you again for your time.
  Reply With Quote
03-06-08, 04:38 AM   #6
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
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.
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."
  Reply With Quote
03-06-08, 06:27 AM   #7
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Originally Posted by Cladhaire View Post
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?).
  Reply With Quote
03-06-08, 06:33 AM   #8
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
Originally Posted by Layrajha View Post
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.
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."
  Reply With Quote
03-06-08, 06:44 AM   #9
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
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...
  Reply With Quote
03-06-08, 06:46 AM   #10
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
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() .. " .")
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."
  Reply With Quote
03-06-08, 07:06 AM   #11
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
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
  Reply With Quote
03-06-08, 07:28 AM   #12
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
Originally Posted by Layrajha View Post
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?
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."
  Reply With Quote
03-06-08, 09:01 AM   #13
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
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
  Reply With Quote
03-06-08, 10:19 AM   #14
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
Originally Posted by Layrajha View Post
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.
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."
  Reply With Quote
03-06-08, 10:21 AM   #15
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Bah, never mind, really There was really no point anyway.
Thanks again for your help and sorry about the digression.
  Reply With Quote

WoWInterface » Featured Projects » Cladhaire's Mods » Recover the target of one of Clique's actions

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