Code snipets 2: multitargeting

4 views
Skip to first unread message

Tayedaen

unread,
Dec 3, 2007, 7:28:23 AM12/3/07
to develop_xub
Hi !

I decided to highlight the important parts of the Multibutton code, so
that we can discuss them (slightly modified for better understanding).

Here comes the multitargeting code:
--------------------------------------------------------------------------------------------------
if aDestinationUnit == "MB-TARGET" then -- different
mouseclicks cast to different targets
myButton:SetAttribute("*unit2", "player") -- right click
myButton:SetAttribute("*unit3", "target") -- middle click
myButton:SetAttribute("*unit4", "focus") -- button 4 click
myButton.Multitarget = "MB-TARGET"
elseif aDestinationUnit == "KB-TARGET" then -- different keyboard
modifier cast to different targets
myButton:SetAttribute("alt-unit*", "player")
myButton:SetAttribute("shift-unit*", "target")
myButton:SetAttribute("ctrl-unit*", "focus")
myButton.Multitarget = "KB-TARGET"
end
myButton:SetAttribute("*unit*", l_mainDestinationUnit) -- all other
clicks (minus the ones defined above)
----------------------------------------------------------------------------------------

And YES, that's the only IF her - so no big performance impact is to
be expected here.


Additional code, needed for every kind of multibuttons:
myButton:RegisterForClicks("AnyUp");

Cosmic Cleric

unread,
Dec 3, 2007, 12:50:19 PM12/3/07
to develop_xub
My only concern is the hard-coded assignment of button 4, so that when
my mouse pointer is hovering over a XUB button and I press this button
to talk on my Ventrillo client, instead a XUB action will occur. I
truly don't men to sound over dramatic, but this really is a show-
stopper for me. I would either have to branch XUB or with every
release go in and remove this code (which would be a pain to do). I
hover my mouse pointer over a button (in pvp) all the time, waiting
for a cooldown to finish or for a target to come into range (etc.),
but am talking with teammates via Ventrillo the whole time I'm waiting
for cooldown/in-range to occur.

Maybe if this new code/feature was ONLY active for the floating bar,
and ignored for the other bars? But even still, wouldn't a floating
bar be about working on the target frame selection anyways? Is dynamic
target selection from the floating bar really needed? I could see the
want to dynamically target via a generic button in general, but XUB
was always about defining buttons and attaching them to particular
target frames. /shrug

If nothing else, please don't hard-code the keyboard/mouse button
assignments. One persons 'focus' target is another person's Ventrillo
talk. :)
Reply all
Reply to author
Forward
0 new messages