code snipets 1: multiranking

1 view
Skip to first unread message

Tayedaen

unread,
Dec 3, 2007, 7:29:52 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 multiranking part:
--------------------------------------------------------------------------------------------------
if ( aRank ) and ( string.find( string.upper(aRank), "RANKED" ) ) then

if string.upper(aRank) == "MB-RANKED" then --different
mouseclicks cast different ranks
myButton:SetAttribute("*spell2", aSpellName .. "(" .. RANK ..
" 1)" ) -- right click
myButton:SetAttribute("*spell3", aSpellName .. "(" .. RANK ..
" " .. math.ceil((l_MaxSpellRank+1) / 2) .. ")" ) --middle click
myButton.Multirank = "MB-RANKED"
elseif string.upper(aRank) == "KB-RANKED" then --different
keyboard modifier cast different ranks
myButton:SetAttribute("shift-spell*", aSpellName .. "(" ..
RANK .. " 1)" )
myButton:SetAttribute("alt-spell*", aSpellName .. "(" ..
RANK .. " " .. math.ceil((l_MaxSpellRank+1) / 2) .. ")" )
myButton.Multirank = "KB-RANKED"
end
myButton.FullSpellName = aSpellName .. "()";
end
myButton:SetAttribute("*spell*", myButton.FullSpellName ) --all
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");

Reply all
Reply to author
Forward
0 new messages