Thread Tools Display Modes
11-04-18, 09:45 PM   #1
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
[ADDON_ACTION_BLOCKED] tried to call the protected function "<unnamed>:SetHeight()".

Hi all,

I am currently making an addon that displays all the enemies' unitframe by reproducing nameplates based on NAME_PLATE_CREATED, NAME_PLATE_UNIT_ADDED, NAME_PLATE_UNIT_REMOVED events.

Lua Code:
  1. function AddOn:NAME_PLATE_CREATED(...)
  2.     local setting = AddOn.db.global;
  3.  
  4.     -- Create nameplate
  5.     local nameplate = CreateFrame("Frame", nil, self);
  6.     nameplate:SetSize(setting.width, setting.iconSize);
  7.    
  8.     -- Position each nameplates
  9.     local listLength = #self.nameplateList;
  10.     if (listLength == 0) then
  11.         nameplate:SetPoint("TOP");
  12.     else
  13.         nameplate:SetPoint("TOP", self.nameplateList[listLength], "BOTTOM", 0, -3);
  14.     end
  15.  
  16.     self.nameplateList[listLength + 1] = nameplate;
  17.    
  18.     local health = CreateFrame("StatusBar", nil, nameplate);
  19.     health:SetStatusBarTexture(LSM:Fetch("statusbar", setting.texture));
  20.     health:SetMinMaxValues(0, 1);
  21.     health:SetAllPoints(nameplate);
  22.    
  23.     nameplate.health = health;
  24.  
  25.     -- Adjust the height on nameplate creation
  26.     if (listLength == 1) then
  27.         self:SetHeight(setting.iconSize);
  28.     elseif (listLength > 1) then
  29.         self:SetHeight(self:GetHeight() + 3 + setting.iconSize);
  30.     end
  31. end
  32.  
  33. function InitializeHandler()
  34.     local setting = AddOn.db.global;
  35.  
  36.     local handler = CreateFrame("Frame", nil, UIParent, "SecureHandlerStateTemplate");
  37.     handler:SetWidth(setting.width);
  38.     handler:CustomSetPoint(setting.point);
  39.  
  40.     RegisterStateDriver(handler, "visibility", "[petbattle] hide; show");
  41.    
  42.     AddOn.handler = handler;
  43.  
  44.     handler.nameplateList = {};
  45. end

I am aware of that this taint is occurring because the new nameplates are being created and the height is set while in the combat.

+ The reason that I am using SecureHandlerStateTemplate is to hide such frame while in a pet battle (as it is shown in L#40).

Is there any possible solution to prevent such taint occurring? Or should I only use my handler only to hide/show the frame in/out of pet battle, and create another frame on top of it which manages visual part?

Thank you!
  Reply With Quote
11-04-18, 11:56 PM   #2
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
You really don't want to use secure templates for your nameplates, speaking from experience.

Moreover, aren't nameplates hidden while pet battling anyway? Why are you trying to do that manually? O_o
__________________
  Reply With Quote
11-05-18, 06:20 AM   #3
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
Originally Posted by lightspark View Post
You really don't want to use secure templates for your nameplates, speaking from experience.

Moreover, aren't nameplates hidden while pet battling anyway? Why are you trying to do that manually? O_o
Hi lightspark,

First of all, it was a bad word choice of me

What I meant was that I am trying to create a list of unitframes which works like nameplates, but instead of hovering above the unit they will be lined up at a certain position.

Something like this:



I've made some modifications after posting this thread and now there are basically two templates being used.

Lua Code:
  1. function AddOn:ADDON_LOADED(...)
  2.     if (not ... == addonName) then
  3.         return;
  4.     end
  5.  
  6.     InitializeHandler();
  7.  
  8.     self:UnregisterEvent("ADDON_LOADED");
  9. end
  10.  
  11. -- @self - handler
  12. function AddOn:NAME_PLATE_CREATED(event, ...)
  13.     local setting = AddOn.db.global;
  14.  
  15.     -- Create nameplate
  16.     local nameplate = CreateFrame("Frame", nil, self, "SecureUnitButtonTemplate");
  17.     nameplate:SetSize(setting.width, setting.iconSize);
  18.    
  19.     local listLength = #self.nameplateList;
  20.     if (listLength == 0) then
  21.         nameplate:SetPoint("TOP");
  22.     else
  23.         nameplate:SetPoint("TOP", self.nameplateList[listLength], "BOTTOM", 0, -3);
  24.     end
  25.  
  26.     -- Assign unit for each nameplates so that they could mange the visibilities
  27.     nameplate:SetAttribute("unit", "nameplate" .. (listLength + 1));
  28.     RegisterUnitWatch(nameplate);
  29.  
  30.     self.nameplateList[listLength + 1] = nameplate;
  31.  
  32.     local health = CreateFrame("StatusBar", nil, nameplate);
  33.     health:SetStatusBarTexture(LSM:Fetch("statusbar", setting.texture));
  34.     health:SetMinMaxValues(0, 1);
  35.     health:SetAllPoints(nameplate);
  36.    
  37.     nameplate.health = health;
  38.  
  39.     -- Adjust the height of the nameplate on nameplate creation
  40.     if (listLength == 1) then
  41.         self:SetHeight(setting.iconSize);
  42.     elseif (listLength > 1) then
  43.         self:SetHeight(self:GetHeight() + 3 + setting.iconSize);
  44.     end
  45. end
  46.  
  47. function InitializeHandler()
  48.     local setting = AddOn.db.global;
  49.  
  50.     local handler = CreateFrame("Frame", nil, UIParent, "SecureHandlerStateTemplate");
  51.     handler:SetWidth(setting.width);
  52.     handler:CustomSetPoint(setting.point);
  53.  
  54.     RegisterStateDriver(handler, "visibility", "[petbattle] hide; show");
  55.    
  56.     AddOn.handler = handler;
  57.  
  58.     handler.nameplateList = {};
  59. end

One is SecureHandlerStateTemplate for handler object to hide/show frames when the player is in/out of the pet battle as I stated before and the other is SecureUnitButtonTemplate for each nameplates that are being created to give some functionalities like mouseover cast, etc.

The errors that I'm getting are:

Lua Code:
  1. [ADDON_ACTION_BLOCKED] AddOn '<AddOnName>' tried to call the protected function 'SecureStateDriverManager:SetAttribute()'.

Lua Code:
  1. Frame <FrameNameN>: Unknown script element OnClick

mmmmmmmmmmmmmmmmm................

Secure templates are so complicated!!!!!

Last edited by Lyak : 11-05-18 at 06:29 AM.
  Reply With Quote
11-05-18, 06:52 PM   #4
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
Aight, just decided change the structure.

Instead of nameplates being created on NAME_PLATE_CREATED, I decided to create certain amount of nameplates on ADDON_LOADED which will no longer cry for

Lua Code:
  1. [ADDON_ACTION_BLOCKED] AddOn '<AddOnName>' tried to call the protected function 'SecureStateDriverManager:SetAttribute()'.

this error.

So, the current concern is

Lua Code:
  1. Frame <FrameName1>: Unknown script element OnClick
  2. Frame <FrameName2>: Unknown script element OnClick
  3. Frame <FrameName3>: Unknown script element OnClick
  4. Frame <FrameName4>: Unknown script element OnClick
  5. Frame <FrameName5>: Unknown script element OnClick
  6. Frame <FrameName6>: Unknown script element OnClick
  7. Frame <FrameName7>: Unknown script element OnClick
  8. Frame <FrameName8>: Unknown script element OnClick
  9. Frame <FrameName9>: Unknown script element OnClick
  10. Frame <FrameName10>: Unknown script element OnClick

Seriously... what are they?

I thought it was crying because it doesn't have an assigned OnClick script and so I actually gave an empty OnClick script

Lua Code:
  1. frame:SetScript("OnClick", function(self, button, down)
  2.            
  3. end);

then it starts to toss me the following.

Lua Code:
  1. frame doesn't have a "OnClick" script

I've been searching for the solution on google and the only result that I got was from those Z-perl (or X-perl) users reporting such issue and I couldn't really find the answer
  Reply With Quote
11-05-18, 08:54 PM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
What frames have the name FrameName in it ? None of the code you have supplied includes frames with that naming.

The error message itself sounds like it is being caused by an xml file as no line numbers are being reported.

If you have other addons activated, try just your addon and see if those errors still occur.
__________________
  Reply With Quote
11-05-18, 09:29 PM   #6
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
Originally Posted by Xrystal View Post
What frames have the name FrameName in it ? None of the code you have supplied includes frames with that naming.
Sorry I forgot to clearly state that.

They are the frames (nameplates) that I create on NAME_PLATE_CREATED event as shown in L#16 of my first reply.

Originally Posted by Xrystal View Post
The error message itself sounds like it is being caused by an xml file as no line numbers are being reported.

If you have other addons activated, try just your addon and see if those errors still occur.
Interesting

The error persists only when the BugGrabber addon is on

What am I missing...?

I mean I am a big fan(?) of oUF and afaik oUF also uses SecureUnitButtonTemplate which it doesn't report such error even if the BugGrabber addon is turned on......

mmmmmmmmmmmmmmmmmmmmmmmm..................
  Reply With Quote
11-06-18, 12:32 AM   #7
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
Ah... I think I found why...

The object type for my nameplate frame was a Frame rather than a Button....

After changing the type to Button, it stopped crying for that OnClick issue.

Now the next step would be giving some functionalities like mouseover cast and etc
  Reply With Quote
11-06-18, 06:01 AM   #8
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
So you're trying to make your own enemy grid, eh? Don't get your hopes up though, there's a reason why that addon is pretty much dead nowadays.

And yes, frames don't have onclick scripts, good that you figured it out yourself.
__________________

Last edited by lightspark : 11-06-18 at 06:05 AM.
  Reply With Quote
11-06-18, 02:14 PM   #9
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
Originally Posted by lightspark View Post
So you're trying to make your own enemy grid, eh? Don't get your hopes up though, there's a reason why that addon is pretty much dead nowadays.

And yes, frames don't have onclick scripts, good that you figured it out yourself.
Oh god................................. It already did exist................?

But why is it so?

Is that because of the same reason? Blizzard blocked some sort of functionality cause the idea was way too powerful?

Last edited by Lyak : 11-06-18 at 02:37 PM.
  Reply With Quote
11-06-18, 09:13 PM   #10
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Originally Posted by Lyak View Post
Oh god................................. It already did exist................?

But why is it so?

Is that because of the same reason? Blizzard blocked some sort of functionality cause the idea was way too powerful?
Exactly, it's too OP. It allowed for very fluid DoT management across multiple targets, it's so fluid that it became trivial, and that's not something Blizz liked, so they gutted it.

Google "enemy grid nerf". It's a fun read :P
__________________

Last edited by lightspark : 11-06-18 at 09:16 PM.
  Reply With Quote
11-07-18, 04:31 AM   #11
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
Originally Posted by lightspark View Post
Exactly, it's too OP. It allowed for very fluid DoT management across multiple targets, it's so fluid that it became trivial, and that's not something Blizz liked, so they gutted it.

Google "enemy grid nerf". It's a fun read :P
Honestly, I agree with the point that this addon is OP, but at the same time, I would expect Blizzard to make it somewhat easier for those DoT based dealers to dealt with
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » [ADDON_ACTION_BLOCKED] tried to call the protected function "<unnamed>:SetHeight()".

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