Thread Tools Display Modes
12-08-06, 05:29 AM   #1
ProfOak
A Cyclonian
Join Date: Oct 2005
Posts: 47
How to work around protected build-in function in v2.0 ?

Hi!
Thanks for taking the time to read my cry for help :P
With all new changes in 2.0 my addon stoped working and I can't find a way to work around this

I have macros that call my addon functions:
/script MyAddon.MyFunction(); -- CastSpellByName("Mark of the Wild(Rank 1)");

MyAddon.Myfunction:
Myfunction = function()
do a lot of stuff and call MyCastFunction(parameter1, parameter2, etc);
end;

MyCastFunction(parameter1, parameter2, etc)
TargetUnit(parameterY);
CastSpellByName(parameterX);
TargetUnit("playertarget"); or SpellTargetUnit(parameterN);
end;

As you can see, MyCastFunction uses protected build-in functions and I don't know how can I work aroud this
I have know clue if is that macro I must change or if there's a way of running a marco slash command from within addon code, something like:
RunMacroCommand("/cast ["..parameterY.."] "..parameterX..";");

Please help me ^^
Thank You
  Reply With Quote
12-08-06, 08:00 AM   #2
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
You need to use either macros, or secure template. A very basic secure template:

CreateFrame("Button", "MyButton", UIParent, "SecureActionButtonTemplate")
MyButton:SetBackdrop(GameTooltip:GetBackdrop())
MyButton:SetPoint("CENTER", 0, 0)
MyButton:SetHeight(32) MyButton:SetWidth(32)
MyButton:SetAttribute("unit", "player")
MyButton:SetAttribute("type1", "spell")
MyButton:SetAttribute("spell1", "Mark of the Wild")
MyButton:SetAttribute("shift-type1", "spell")
MyButton:SetAttribute("shift-spell1", "Thorns")

That will make a 32x32 button in the center of your screen which when left clicked will cast Mark of the Wild. In addition, when you shift-left click it, it will cast "Thorns", both on 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
12-08-06, 08:14 AM   #3
ProfOak
A Cyclonian
Join Date: Oct 2005
Posts: 47
Thank you for you're reply m8, but there's 1 thing, is it possible to use my "MyCastFunction" instead of a specific spell ? because I don't always won't to use, for exemple, healing touch rank 10, and my addon was making that choice for me, to select the right rank for the apropriate healing.
Is it possible to still make this ?
  Reply With Quote
12-08-06, 08:16 AM   #4
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
No, an addon or macro can not make decisions on target or spell when in combat. You can fumble it outside of combat, but mods are no longer allowed to make combat-sensitive decisions.
__________________
"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
12-08-06, 03:21 PM   #5
ProfOak
A Cyclonian
Join Date: Oct 2005
Posts: 47
OMG
Then my addon is dead and useless :'(

Thank You for the help m8
  Reply With Quote
12-11-06, 04:16 AM   #6
ProfOak
A Cyclonian
Join Date: Oct 2005
Posts: 47
Just 2 more questions, is it possible using the buttons u posted above to chose the rank to be casted ? and is it possible, also using buttons, to use post a chat msg (party/raid/whisper) and then cast the spell ? (or in this case only 1 action is alowd?)

Thank u so much for all the help u already gave

Cheers
  Reply With Quote
12-11-06, 05:58 AM   #7
gariig
A Wyrmkin Dreamwalker
Join Date: Aug 2005
Posts: 50
You can't do auto downranking of spells (except buffs which the default UI handles) anymore that is a combat sensitive decision. You should be able to create a macro or addon that does cast a spell and sends a chat message.
  Reply With Quote
12-11-06, 08:02 AM   #8
ProfOak
A Cyclonian
Join Date: Oct 2005
Posts: 47
I was thinking using something like the button Cladhaire posted but more like this:

CreateFrame("Button", "MyButton", UIParent, "SecureActionButtonTemplate")
MyButton:SetBackdrop(GameTooltip:GetBackdrop())
MyButton:SetPoint("CENTER", 0, 0)
MyButton:SetHeight(32) MyButton:SetWidth(32)
MyButton:SetAttribute("unit", "player")
MyButton:SetAttribute("type1", "spell")
MyButton:SetAttribute("spell1", "Healing Touch (Rank 10)")
MyButton:SetAttribute("shift-type1", "spell")
MyButton:SetAttribute("shift-spell1", "Healing Touch (Rank 8)")

Can this be done ?
  Reply With Quote
12-16-06, 04:27 AM   #9
xbjim
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 58
i think that would work.


you could also make a macro like:

Code:
/cast [button:2,target=player] Healing Touch (Rank 8) 
/cast [target=player] Healing Touch (Rank 10)
button:2 = right clicking.. you could do modifier:shift but shift doesnt work at the moment.

if you clicked that macro normally it would cast healing touch rank10 on you, if you right clicked it would cast healing touch rank8
  Reply With Quote
12-18-06, 03:25 AM   #10
ProfOak
A Cyclonian
Join Date: Oct 2005
Posts: 47
Will give it a shoot m8

Thank all for your help

Cheers
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to work around protected build-in function in v2.0 ?


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